summaryrefslogtreecommitdiffstats
path: root/recipes-wam/cef/files/chromium/0014-meta-browser-Avoid-std-ranges-find_if.patch
blob: 2bd12fae1bdc46a61178a876c2ba2f7fc176238f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From a577e7a76e6002e50b5ab27514b7f49d4070499c Mon Sep 17 00:00:00 2001
From: Max Ihlenfeldt <max@igalia.com>
Date: Wed, 30 Aug 2023 16:06:19 +0000
Subject: [PATCH 14/33] [meta-browser] Avoid std::ranges::find_if()

std::ranges::find_if() was introduced in C++20, and older versions of
clang don't support it. We can instead use Chromium's `base::ranges`
library, which is supported.

Upstream-Status: Inappropriate [specific to older versions of clang]
Signed-off-by: Max Ihlenfeldt <max@igalia.com>
---
 .../password_manager/core/browser/ui/passwords_grouper.cc    | 3 ++-
 components/webauthn/core/browser/passkey_sync_bridge.cc      | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/components/password_manager/core/browser/ui/passwords_grouper.cc b/components/password_manager/core/browser/ui/passwords_grouper.cc
index 1b016e0eb9561..d259c6accf246 100644
--- a/components/password_manager/core/browser/ui/passwords_grouper.cc
+++ b/components/password_manager/core/browser/ui/passwords_grouper.cc
@@ -8,6 +8,7 @@
 #include "base/containers/flat_set.h"
 #include "base/strings/escape.h"
 #include "base/strings/string_util.h"
+#include "base/ranges/algorithm.h"
 #include "components/password_manager/core/browser/affiliation/affiliation_service.h"
 #include "components/password_manager/core/browser/affiliation/affiliation_utils.h"
 #include "components/password_manager/core/browser/passkey_credential.h"
@@ -277,7 +278,7 @@ absl::optional<PasskeyCredential> PasswordsGrouper::GetPasskeyFor(
   const std::vector<PasskeyCredential>& passkeys =
       map_group_id_to_credentials_[group_id_iterator->second].passkeys;
   const auto passkey_it =
-      std::ranges::find_if(passkeys, [&credential](const auto& passkey) {
+      base::ranges::find_if(passkeys, [&credential](const auto& passkey) {
         return credential.passkey_credential_id == passkey.credential_id();
       });
   if (passkey_it == passkeys.end()) {
diff --git a/components/webauthn/core/browser/passkey_sync_bridge.cc b/components/webauthn/core/browser/passkey_sync_bridge.cc
index 93129fed756aa..794c696fcff04 100644
--- a/components/webauthn/core/browser/passkey_sync_bridge.cc
+++ b/components/webauthn/core/browser/passkey_sync_bridge.cc
@@ -16,6 +16,7 @@
 #include "base/containers/span.h"
 #include "base/feature_list.h"
 #include "base/functional/callback_helpers.h"
+#include "base/ranges/algorithm.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/trace_event/trace_event.h"
 #include "components/sync/base/features.h"
@@ -258,7 +259,7 @@ PasskeySyncBridge::GetPasskeysForRelyingPartyId(
 bool PasskeySyncBridge::DeletePasskey(const std::string& credential_id) {
   // Find the credential with the given |credential_id|.
   const auto passkey_it =
-      std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
+      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
         return passkey.second.credential_id() == credential_id;
       });
   if (passkey_it == data_.end()) {
@@ -309,7 +310,7 @@ bool PasskeySyncBridge::UpdatePasskey(const std::string& credential_id,
                                       PasskeyChange change) {
   // Find the credential with the given |credential_id|.
   const auto passkey_it =
-      std::ranges::find_if(data_, [&credential_id](const auto& passkey) {
+      base::ranges::find_if(data_, [&credential_id](const auto& passkey) {
         return passkey.second.credential_id() == credential_id;
       });
   if (passkey_it == data_.end()) {
-- 
2.42.1