[base] Move util::ranges to base::ranges
This change moves the backport of std::ranges algorithms from //base/util/ranges to //base/ranges and updates call sites. TBR=dcheng Bug: 1071094 Change-Id: I696c1f4c27f603255b32845d8b7fb4e176190367 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362816 Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#806105}
This commit is contained in:

committed by
Commit Bot

parent
7a1d6b4740
commit
a94154612c
ash
base
BUILD.gn
ranges
OWNERSREADME.mdalgorithm.halgorithm_unittest.ccfunctional.hfunctional_unittest.cciterator.hranges.hranges_internal.hranges_unittest.cc
util
chrome/browser
BUILD.gn
chromeos
component_updater
ui
BUILD.gn
global_media_controls
media_notification_device_provider_impl.ccmedia_notification_device_provider_impl_unittest.ccmedia_notification_service.cc
views
chromecast/renderer
components
password_manager
core
url_formatter
spoof_checks
top_domains
content/browser
services/network
public
cpp
trust_tokens
styleguide/c++
ui/views
@ -2229,7 +2229,6 @@ test("ash_unittests") {
|
||||
"//ash/system/machine_learning:user_settings_event_proto",
|
||||
"//base",
|
||||
"//base/test:test_support",
|
||||
"//base/util/ranges",
|
||||
"//base/util/values:values_util",
|
||||
"//build:branding_buildflags",
|
||||
"//chromeos:test_support",
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "ash/public/cpp/login_types.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "base/bind_helpers.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "chromeos/strings/grit/chromeos_strings.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@ -163,7 +163,7 @@ TEST_P(LoginExpandedPublicAccountViewTest, ShowWarningDialog) {
|
||||
|
||||
// Tap on the learn more link.
|
||||
const auto& children = test_api.learn_more_label()->children();
|
||||
const auto it = util::ranges::find(children, views::Link::kViewClassName,
|
||||
const auto it = base::ranges::find(children, views::Link::kViewClassName,
|
||||
&views::View::GetClassName);
|
||||
DCHECK(it != children.cend());
|
||||
TapOnView(*it);
|
||||
|
@ -499,6 +499,11 @@ component("base") {
|
||||
"rand_util.cc",
|
||||
"rand_util.h",
|
||||
"rand_util_nacl.cc",
|
||||
"ranges/algorithm.h",
|
||||
"ranges/functional.h",
|
||||
"ranges/iterator.h",
|
||||
"ranges/ranges.h",
|
||||
"ranges/ranges_internal.h",
|
||||
"run_loop.cc",
|
||||
"run_loop.h",
|
||||
"sampling_heap_profiler/lock_free_address_hash_set.cc",
|
||||
@ -2794,6 +2799,9 @@ test("base_unittests") {
|
||||
"profiler/stack_sampler_impl_unittest.cc",
|
||||
"profiler/stack_sampling_profiler_unittest.cc",
|
||||
"rand_util_unittest.cc",
|
||||
"ranges/algorithm_unittest.cc",
|
||||
"ranges/functional_unittest.cc",
|
||||
"ranges/ranges_unittest.cc",
|
||||
"run_loop_unittest.cc",
|
||||
"safe_numerics_unittest.cc",
|
||||
"sampling_heap_profiler/lock_free_address_hash_set_unittest.cc",
|
||||
|
@ -1,15 +1,15 @@
|
||||
# `util::ranges`
|
||||
# `base::ranges`
|
||||
|
||||
This directory aims to implement a C++14 version of the new `std::ranges`
|
||||
algorithms that were introduced in C++20. These implementations are added to the
|
||||
`::util::ranges` namespace, and callers can access them by including
|
||||
[`base/util/ranges/algorithm.h`](https://source.chromium.org/chromium/chromium/src/+/master:base/util/ranges/algorithm.h).
|
||||
`::base::ranges` namespace, and callers can access them by including
|
||||
[`base/ranges/algorithm.h`](https://source.chromium.org/chromium/chromium/src/+/master:base/ranges/algorithm.h).
|
||||
|
||||
## Similarities with C++20:
|
||||
|
||||
### Automatically deducing `begin()` and `end()`
|
||||
As probably one of the most important changes for readability and usability, all
|
||||
algorithms in `util::ranges` have overloads for ranges of elements, which allow
|
||||
algorithms in `base::ranges` have overloads for ranges of elements, which allow
|
||||
callers to no longer specify `begin()` and `end()` iterators themselves.
|
||||
|
||||
Before:
|
||||
@ -22,7 +22,7 @@ bool HasEvens(const std::vector<int>& vec) {
|
||||
After:
|
||||
```c++
|
||||
bool HasEvens(const std::vector<int>& vec) {
|
||||
return util::ranges::any_of(vec, [](int i) { return i % 2 == 0; });
|
||||
return base::ranges::any_of(vec, [](int i) { return i % 2 == 0; });
|
||||
}
|
||||
```
|
||||
|
||||
@ -46,13 +46,13 @@ bool HasEvens() {
|
||||
After:
|
||||
```c++
|
||||
bool HasEvens() {
|
||||
return util::ranges::any_of(GetNums(), [](int i) { return i % 2 == 0; });
|
||||
return base::ranges::any_of(GetNums(), [](int i) { return i % 2 == 0; });
|
||||
}
|
||||
```
|
||||
|
||||
### Support for Projections
|
||||
In addition to supporting automatically deducing the `begin()` and `end()`
|
||||
iterator for ranges, the `util::ranges::` algorithms also support projections,
|
||||
iterator for ranges, the `base::ranges::` algorithms also support projections,
|
||||
that can be applied to arguments prior to passing it to supplied transformations
|
||||
or predicates. This is especially useful when ordering a collection of classes
|
||||
by a specific data member of the class. Example:
|
||||
@ -67,17 +67,17 @@ std::sort(suggestions->begin(), suggestions->end(),
|
||||
|
||||
After:
|
||||
```cpp
|
||||
util::ranges::sort(*suggestions, /*comp=*/{}, &autofill::Suggestion::match);
|
||||
base::ranges::sort(*suggestions, /*comp=*/{}, &autofill::Suggestion::match);
|
||||
```
|
||||
|
||||
Anything that is callable can be used as a projection. This includes
|
||||
`FunctionObjects` like function pointers or functors, but also pointers to
|
||||
member function and pointers to data members, as shown above. When not specified
|
||||
a projection defaults to `util::ranges::identity`, which simply perfectly
|
||||
a projection defaults to `base::ranges::identity`, which simply perfectly
|
||||
forwards its argument.
|
||||
|
||||
Projections are supported in both range and iterator-pair overloads of the
|
||||
`util::ranges::` algorithms, for example `util::ranges::all_of` has the
|
||||
`base::ranges::` algorithms, for example `base::ranges::all_of` has the
|
||||
following signatures:
|
||||
|
||||
```cpp
|
||||
@ -89,7 +89,7 @@ bool all_of(Range&& range, Pred pred, Proj proj = {});
|
||||
```
|
||||
|
||||
## Differences from C++20:
|
||||
To simplify the implementation of the `util::ranges::` algorithms, they dispatch
|
||||
To simplify the implementation of the `base::ranges::` algorithms, they dispatch
|
||||
to the `std::` algorithms found in C++14. This leads to the following list of
|
||||
differences from C++20. Since most of these differences are differences in the
|
||||
library and not in the language, they could be addressed in the future by adding
|
||||
@ -97,7 +97,7 @@ corresponding implementations.
|
||||
|
||||
### Lack of Constraints
|
||||
Due to the lack of support for concepts in the language, the algorithms in
|
||||
`util::ranges` do not have the constraints that are present on the algorithms in
|
||||
`base::ranges` do not have the constraints that are present on the algorithms in
|
||||
`std::ranges`. Instead, they support any type, much like C++14's `std::`
|
||||
algorithms. In the future this might be addressed by adding corresponding
|
||||
constraints via SFINAE, should the need arise.
|
||||
@ -110,18 +110,18 @@ C++14's implementation, the type must be the same. This could be addressed in
|
||||
the future by implementing support for sentinel types ourselves.
|
||||
|
||||
### Lack of `constexpr`
|
||||
The `util::ranges` algorithms can only be used in a `constexpr` context when
|
||||
The `base::ranges` algorithms can only be used in a `constexpr` context when
|
||||
they call underlying `std::` algorithms that are themselves `constexpr`. Before
|
||||
C++20, only `std::min`, `std::max` and `std::minmax` are annotated
|
||||
appropriately, so code like `constexpr bool foo = util::ranges::any_of(...);`
|
||||
appropriately, so code like `constexpr bool foo = base::ranges::any_of(...);`
|
||||
will fail because the compiler will not find a `constexpr std::any_of`. This
|
||||
could be addressed by either upgrading Chromium's STL to C++20, or implementing
|
||||
`constexpr` versions of some of these algorithms ourselves.
|
||||
|
||||
### Lack of post C++14 algorithms
|
||||
Since most algorithms in `util::ranges` dispatch to their C++14 equivalent, some
|
||||
Since most algorithms in `base::ranges` dispatch to their C++14 equivalent, some
|
||||
`std::` algorithms that are not present in C++14 have no implementation in
|
||||
`util::ranges`. This list of algorithms includes the following:
|
||||
`base::ranges`. This list of algorithms includes the following:
|
||||
|
||||
- [`std::sample`](https://en.cppreference.com/w/cpp/algorithm/sample) (added in C++17)
|
||||
|
||||
@ -131,7 +131,7 @@ equivalent in `std::`. For example, while `std::for_each` returns the passed-in
|
||||
`Function`, `std::ranges::for_each` returns a `std::ranges::for_each_result`,
|
||||
consisting of the `last` iterator and the function.
|
||||
|
||||
In the cases where the return type differs, `util::ranges::` algorithms will
|
||||
In the cases where the return type differs, `base::ranges::` algorithms will
|
||||
continue to return the old return type.
|
||||
|
||||
### No blocking of ADL
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_UTIL_RANGES_ALGORITHM_H_
|
||||
#define BASE_UTIL_RANGES_ALGORITHM_H_
|
||||
#ifndef BASE_RANGES_ALGORITHM_H_
|
||||
#define BASE_RANGES_ALGORITHM_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
@ -11,12 +11,12 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "base/util/ranges/functional.h"
|
||||
#include "base/util/ranges/iterator.h"
|
||||
#include "base/util/ranges/ranges.h"
|
||||
#include "base/util/ranges/ranges_internal.h"
|
||||
#include "base/ranges/functional.h"
|
||||
#include "base/ranges/iterator.h"
|
||||
#include "base/ranges/ranges.h"
|
||||
#include "base/ranges/ranges_internal.h"
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
namespace ranges {
|
||||
|
||||
@ -4953,6 +4953,6 @@ constexpr auto prev_permutation(Range&& range, Comp comp = {}, Proj proj = {}) {
|
||||
|
||||
} // namespace ranges
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_UTIL_RANGES_ALGORITHM_H_
|
||||
#endif // BASE_RANGES_ALGORITHM_H_
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@ -11,7 +11,7 @@
|
||||
#include <random>
|
||||
#include <utility>
|
||||
|
||||
#include "base/util/ranges/functional.h"
|
||||
#include "base/ranges/functional.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -23,7 +23,7 @@ using ::testing::Le;
|
||||
using ::testing::Lt;
|
||||
using ::testing::Pair;
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1664,4 +1664,4 @@ TEST(RangesTest, PrevPermutation) {
|
||||
EXPECT_THAT(bits, ElementsAre(0, 0, 0, 1, 0));
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_UTIL_RANGES_FUNCTIONAL_H_
|
||||
#define BASE_UTIL_RANGES_FUNCTIONAL_H_
|
||||
#ifndef BASE_RANGES_FUNCTIONAL_H_
|
||||
#define BASE_RANGES_FUNCTIONAL_H_
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
namespace internal {
|
||||
|
||||
@ -187,6 +187,6 @@ using greater_equal = std::greater_equal<>;
|
||||
using less_equal = std::less_equal<>;
|
||||
} // namespace ranges
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_UTIL_RANGES_FUNCTIONAL_H_
|
||||
#endif // BASE_RANGES_FUNCTIONAL_H_
|
@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/util/ranges/functional.h"
|
||||
#include "base/ranges/functional.h"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
TEST(RangesTest, Identity) {
|
||||
static constexpr identity id;
|
||||
@ -56,4 +56,4 @@ TEST(RangesTest, Less) {
|
||||
EXPECT_FALSE(lt(1, 0));
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
@ -2,16 +2,16 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_UTIL_RANGES_ITERATOR_H_
|
||||
#define BASE_UTIL_RANGES_ITERATOR_H_
|
||||
#ifndef BASE_RANGES_ITERATOR_H_
|
||||
#define BASE_RANGES_ITERATOR_H_
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "base/util/ranges/functional.h"
|
||||
#include "base/ranges/functional.h"
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
// Simplified implementation of C++20's std::iter_value_t.
|
||||
// As opposed to std::iter_value_t, this implementation does not restrict
|
||||
@ -55,6 +55,6 @@ struct projected {
|
||||
IndirectResultT operator*() const; // not defined
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_UTIL_RANGES_ITERATOR_H_
|
||||
#endif // BASE_RANGES_ITERATOR_H_
|
@ -2,18 +2,18 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_UTIL_RANGES_RANGES_H_
|
||||
#define BASE_UTIL_RANGES_RANGES_H_
|
||||
#ifndef BASE_RANGES_RANGES_H_
|
||||
#define BASE_RANGES_RANGES_H_
|
||||
|
||||
#include <array>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "base/util/ranges/iterator.h"
|
||||
#include "base/util/ranges/ranges_internal.h"
|
||||
#include "base/ranges/iterator.h"
|
||||
#include "base/ranges/ranges_internal.h"
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
namespace ranges {
|
||||
|
||||
@ -136,6 +136,6 @@ using range_value_t = iter_value_t<iterator_t<Range>>;
|
||||
|
||||
} // namespace ranges
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_UTIL_RANGES_RANGES_H_
|
||||
#endif // BASE_RANGES_RANGES_H_
|
@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_UTIL_RANGES_RANGES_INTERNAL_H_
|
||||
#define BASE_UTIL_RANGES_RANGES_INTERNAL_H_
|
||||
#ifndef BASE_RANGES_RANGES_INTERNAL_H_
|
||||
#define BASE_RANGES_RANGES_INTERNAL_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
namespace ranges {
|
||||
namespace internal {
|
||||
|
||||
@ -22,6 +22,6 @@ struct priority_tag<0> {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace ranges
|
||||
} // namespace util
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_UTIL_RANGES_RANGES_INTERNAL_H_
|
||||
#endif // BASE_RANGES_RANGES_INTERNAL_H_
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/util/ranges/ranges.h"
|
||||
#include "base/ranges/ranges.h"
|
||||
|
||||
#include <array>
|
||||
#include <initializer_list>
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace util {
|
||||
namespace base {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -116,4 +116,4 @@ TEST(RangesTest, BeginEndStdArray) {
|
||||
static_assert(array[2] == 2, "");
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace base
|
@ -7,7 +7,6 @@ import("//testing/test.gni")
|
||||
test("base_util_unittests") {
|
||||
deps = [
|
||||
"memory_pressure:unittests",
|
||||
"ranges:unittests",
|
||||
"timer:unittests",
|
||||
"type_safety:tests",
|
||||
"values:unittests",
|
||||
|
@ -1,28 +0,0 @@
|
||||
# Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
source_set("ranges") {
|
||||
sources = [
|
||||
"algorithm.h",
|
||||
"functional.h",
|
||||
"iterator.h",
|
||||
"ranges.h",
|
||||
"ranges_internal.h",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("unittests") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"algorithm_unittest.cc",
|
||||
"functional_unittest.cc",
|
||||
"ranges_unittest.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":ranges",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
]
|
||||
}
|
@ -1835,7 +1835,6 @@ static_library("browser") {
|
||||
|
||||
public_deps = [
|
||||
"//base",
|
||||
"//base/util/ranges",
|
||||
"//chrome/common",
|
||||
"//chrome/common:buildflags",
|
||||
"//chrome/services/file_util/public/mojom",
|
||||
|
@ -71,7 +71,7 @@ source_set("chromeos") {
|
||||
"//ash/public/cpp",
|
||||
"//ash/public/cpp/external_arc",
|
||||
"//ash/public/mojom",
|
||||
"//base/util/ranges:ranges",
|
||||
"//base",
|
||||
"//base/util/timer",
|
||||
"//build:branding_buildflags",
|
||||
"//chrome/app:command_ids",
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/time/default_tick_clock.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "chrome/browser/chromeos/profiles/profile_helper.h"
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
#include "components/session_manager/core/session_manager.h"
|
||||
@ -306,7 +306,7 @@ void HttpFirewallRoutine::Connect(int socket_index) {
|
||||
void HttpFirewallRoutine::OnSocketConnected(int socket_index, int result) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
const auto* iter = util::ranges::find(kRetryResponseCodes, result);
|
||||
const auto* iter = base::ranges::find(kRetryResponseCodes, result);
|
||||
if (iter != std::end(kRetryResponseCodes) && num_retries_ > 0) {
|
||||
num_retries_--;
|
||||
// Disconnect the socket in case there is any data in the incoming buffer.
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "components/autofill/core/browser/geo/country_data.h"
|
||||
#include "components/autofill/core/common/autofill_prefs.h"
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
@ -89,7 +89,7 @@ bool AutofillStatesComponentInstallerPolicy::VerifyInstallation(
|
||||
const base::DictionaryValue& manifest,
|
||||
const base::FilePath& install_dir) const {
|
||||
// Verify that state files are present.
|
||||
return util::ranges::count(
|
||||
return base::ranges::count(
|
||||
AutofillStateFileNames(), true, [&](const auto& filename) {
|
||||
return base::PathExists(install_dir.Append(filename));
|
||||
}) > 0;
|
||||
|
@ -19,10 +19,10 @@
|
||||
#include "base/location.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/values.h"
|
||||
#include "base/version.h"
|
||||
#include "components/component_updater/component_installer.h"
|
||||
@ -105,7 +105,7 @@ constexpr std::array<uint8_t, 32> kZxcvbnDataPublicKeySha256 = {
|
||||
bool ZxcvbnDataComponentInstallerPolicy::VerifyInstallation(
|
||||
const base::DictionaryValue& manifest,
|
||||
const base::FilePath& install_dir) const {
|
||||
return util::ranges::all_of(kTagAndFileNamePairs, [&](const auto& pair) {
|
||||
return base::ranges::all_of(kTagAndFileNamePairs, [&](const auto& pair) {
|
||||
return base::PathExists(install_dir.Append(pair.file_name));
|
||||
});
|
||||
}
|
||||
|
@ -4025,7 +4025,7 @@ static_library("ui") {
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//base/util/ranges",
|
||||
"//base",
|
||||
"//base/util/timer",
|
||||
"//chrome/browser/ui/views",
|
||||
"//chrome/common/qr_code_generator",
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h"
|
||||
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_device_monitor.h"
|
||||
#include "content/public/browser/audio_service.h"
|
||||
#include "media/audio/audio_device_description.h"
|
||||
@ -17,7 +17,7 @@ namespace {
|
||||
void MaybeRemoveDefaultDevice(media::AudioDeviceDescriptions& descriptions) {
|
||||
// Determine which of the audio devices is the fallback "default" device.
|
||||
auto default_device_it =
|
||||
util::ranges::find_if(descriptions, [](const auto& description) {
|
||||
base::ranges::find_if(descriptions, [](const auto& description) {
|
||||
return description.unique_id ==
|
||||
media::AudioDeviceDescription::kDefaultDeviceId;
|
||||
});
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_device_provider_impl.h"
|
||||
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "media/audio/audio_device_description.h"
|
||||
#include "media/audio/audio_system.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
@ -59,7 +59,7 @@ class MockAudioSystem : public media::AudioSystem {
|
||||
|
||||
bool DescriptionsAreEqual(const media::AudioDeviceDescriptions& lhs,
|
||||
const media::AudioDeviceDescriptions& rhs) {
|
||||
return util::ranges::equal(lhs, rhs, [](const auto& lhs, const auto& rhs) {
|
||||
return base::ranges::equal(lhs, rhs, [](const auto& lhs, const auto& rhs) {
|
||||
// Group IDs are not used by this test and are therefore ignored in
|
||||
// comparison.
|
||||
return lhs.device_name == rhs.device_name && lhs.unique_id == rhs.unique_id;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "base/callback_list.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
#include "chrome/browser/media/router/presentation/start_presentation_context.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@ -165,7 +165,7 @@ void MediaNotificationService::Session::MediaSessionInfoChanged(
|
||||
void MediaNotificationService::Session::MediaSessionActionsChanged(
|
||||
const std::vector<media_session::mojom::MediaSessionAction>& actions) {
|
||||
bool is_audio_device_switching_supported =
|
||||
util::ranges::find(
|
||||
base::ranges::find(
|
||||
actions,
|
||||
media_session::mojom::MediaSessionAction::kSwitchAudioDevice) !=
|
||||
actions.end();
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/ui/views/autofill/payments/payments_view_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "build/branding_buildflags.h"
|
||||
#include "chrome/app/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/ui/views/chrome_layout_provider.h"
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
|
||||
#include "chrome/browser/ui/browser_dialogs.h"
|
||||
@ -252,7 +252,7 @@ void ContentSettingBubbleContents::ListItemContainer::AddItem(
|
||||
link->set_callback(base::BindRepeating(
|
||||
[](const std::vector<Row>* items, const views::Link* link,
|
||||
ContentSettingBubbleContents* parent, int event_flags) {
|
||||
const auto it = util::ranges::find(*items, link, &Row::second);
|
||||
const auto it = base::ranges::find(*items, link, &Row::second);
|
||||
DCHECK(it != items->cend());
|
||||
parent->LinkClicked(std::distance(items->cbegin(), it), event_flags);
|
||||
},
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/math_constants.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/ranges/functional.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/util/ranges/functional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/buildflag.h"
|
||||
#include "cc/paint/paint_flags.h"
|
||||
@ -538,7 +538,7 @@ gfx::Size DownloadItemView::CalculatePreferredSize() const {
|
||||
width +=
|
||||
kStartPadding * 2 + icon_size.width() + label->width() + kEndPadding;
|
||||
height = std::max(height, icon_size.height());
|
||||
const int visible_buttons = util::ranges::count(
|
||||
const int visible_buttons = base::ranges::count(
|
||||
std::array<const views::View*, 4>{save_button_, discard_button_,
|
||||
scan_button_, open_now_button_},
|
||||
true, &views::View::GetVisible);
|
||||
@ -1123,7 +1123,7 @@ int DownloadItemView::GetLabelWidth(const views::StyledLabel& label) const {
|
||||
// TODO(pkasting): Can use std::iota_view() when C++20 is available.
|
||||
std::vector<int> widths(max_width + 1 - min_width);
|
||||
std::iota(widths.begin(), widths.end(), min_width);
|
||||
return *util::ranges::lower_bound(widths, 2, util::ranges::greater{},
|
||||
return *base::ranges::lower_bound(widths, 2, base::ranges::greater{},
|
||||
std::move(lines_for_width));
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#include "chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_container_impl.h"
|
||||
#include "chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
@ -271,7 +271,7 @@ void MediaNotificationDeviceSelectorView::UpdateCurrentAudioDevice(
|
||||
if (current_device_entry_view_)
|
||||
current_device_entry_view_->SetHighlighted(false);
|
||||
|
||||
auto it = util::ranges::find_if(
|
||||
auto it = base::ranges::find_if(
|
||||
audio_device_entries_container_->children(),
|
||||
[¤t_device_id](auto& item) {
|
||||
return static_cast<DeviceEntryView*>(item)->GetDeviceId() ==
|
||||
@ -420,7 +420,7 @@ bool MediaNotificationDeviceSelectorView::ShouldBeVisible() {
|
||||
// * Or, there are two devices and one of them has the default ID but not the
|
||||
// default name.
|
||||
if (audio_device_entries_container_->children().size() == 2) {
|
||||
return util::ranges::any_of(
|
||||
return base::ranges::any_of(
|
||||
audio_device_entries_container_->children(), [](views::View* view) {
|
||||
auto* entry = static_cast<DeviceEntryView*>(view);
|
||||
return entry->GetDeviceId() ==
|
||||
|
10
chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
10
chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc
@ -5,9 +5,9 @@
|
||||
#include "chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view.h"
|
||||
|
||||
#include "base/callback_list.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_device_provider.h"
|
||||
#include "chrome/browser/ui/global_media_controls/media_notification_service.h"
|
||||
#include "chrome/browser/ui/views/global_media_controls/media_notification_device_selector_view_delegate.h"
|
||||
@ -233,8 +233,8 @@ TEST_F(MediaNotificationDeviceSelectorViewTest, DeviceHighlightedOnChange) {
|
||||
|
||||
// There should be only one highlighted button. It should be the first button.
|
||||
// It's text should be "Speaker"
|
||||
EXPECT_EQ(util::ranges::count_if(container_children, IsHighlighted), 1);
|
||||
EXPECT_EQ(util::ranges::find_if(container_children, IsHighlighted),
|
||||
EXPECT_EQ(base::ranges::count_if(container_children, IsHighlighted), 1);
|
||||
EXPECT_EQ(base::ranges::find_if(container_children, IsHighlighted),
|
||||
container_children.begin());
|
||||
EXPECT_EQ(EntryLabelText(container_children.front()), "Speaker");
|
||||
|
||||
@ -242,8 +242,8 @@ TEST_F(MediaNotificationDeviceSelectorViewTest, DeviceHighlightedOnChange) {
|
||||
view_->UpdateCurrentAudioDevice("3");
|
||||
|
||||
// The button for "Earbuds" should come before all others & be highlighted.
|
||||
EXPECT_EQ(util::ranges::count_if(container_children, IsHighlighted), 1);
|
||||
EXPECT_EQ(util::ranges::find_if(container_children, IsHighlighted),
|
||||
EXPECT_EQ(base::ranges::count_if(container_children, IsHighlighted), 1);
|
||||
EXPECT_EQ(base::ranges::find_if(container_children, IsHighlighted),
|
||||
container_children.begin());
|
||||
EXPECT_EQ(EntryLabelText(container_children.front()), "Earbuds");
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "base/feature_list.h"
|
||||
#include "base/i18n/number_formatting.h"
|
||||
#include "base/metrics/user_metrics.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/app/chrome_command_ids.h"
|
||||
#include "chrome/browser/command_updater.h"
|
||||
@ -495,7 +495,7 @@ void ToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
|
||||
DCHECK(display_mode_ == DisplayMode::NORMAL);
|
||||
const std::array<views::Button*, 5> kButtons{back_, forward_, reload_, home_,
|
||||
avatar_};
|
||||
auto* button = *util::ranges::find(kButtons, id, &views::Button::tag);
|
||||
auto* button = *base::ranges::find(kButtons, id, &views::Button::tag);
|
||||
DCHECK(button);
|
||||
button->SetEnabled(enabled);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ cast_source_set("renderer") {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//base/util/ranges",
|
||||
"//chromecast:chromecast_buildflags",
|
||||
"//chromecast/base",
|
||||
"//chromecast/common",
|
||||
|
@ -11,11 +11,11 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/time/default_clock.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "chromecast/chromecast_buildflags.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "net/base/escape.h"
|
||||
@ -373,7 +373,7 @@ bool IdentificationSettingsManager::IsAllowed(const GURL& gurl) {
|
||||
return false;
|
||||
|
||||
const std::string& host_name = base::ToLowerASCII(gurl.host());
|
||||
if (util::ranges::find(full_host_names_, host_name) !=
|
||||
if (base::ranges::find(full_host_names_, host_name) !=
|
||||
full_host_names_.end()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -281,7 +281,6 @@ static_library("browser") {
|
||||
":proto",
|
||||
"//base",
|
||||
"//base:i18n",
|
||||
"//base/util/ranges:ranges",
|
||||
"//components/autofill/core/browser",
|
||||
"//components/autofill/core/browser/proto",
|
||||
"//components/autofill/core/common",
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "components/password_manager/core/browser/leak_detection/encryption_utils.h"
|
||||
#include "components/password_manager/core/browser/password_store.h"
|
||||
#include "components/password_manager/core/common/password_manager_features.h"
|
||||
@ -45,7 +45,7 @@ void LeakDetectionDelegateHelper::ProcessLeakedPassword(
|
||||
void LeakDetectionDelegateHelper::OnGetPasswordStoreResults(
|
||||
std::vector<std::unique_ptr<autofill::PasswordForm>> results) {
|
||||
// Store the results.
|
||||
util::ranges::move(results, std::back_inserter(partial_results_));
|
||||
base::ranges::move(results, std::back_inserter(partial_results_));
|
||||
|
||||
// If we're still awaiting more results, nothing else to do.
|
||||
if (--wait_counter_ > 0)
|
||||
@ -68,7 +68,7 @@ void LeakDetectionDelegateHelper::OnGetPasswordStoreResults(
|
||||
}
|
||||
|
||||
IsSaved is_saved(
|
||||
util::ranges::any_of(partial_results_, [this](const auto& form) {
|
||||
base::ranges::any_of(partial_results_, [this](const auto& form) {
|
||||
return form->url == url_ && form->username_value == username_;
|
||||
}));
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "components/password_manager/core/browser/multi_store_form_fetcher.h"
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/autofill/core/common/save_password_progress_logger.h"
|
||||
#include "components/password_manager/core/browser/password_feature_manager.h"
|
||||
@ -168,7 +168,7 @@ void MultiStoreFormFetcher::OnGetCompromisedCredentials(
|
||||
std::vector<CompromisedCredentials> compromised_credentials) {
|
||||
// Both the profile and account store has been queried. Therefore, append the
|
||||
// received credentials to the existing ones.
|
||||
util::ranges::move(compromised_credentials,
|
||||
base::ranges::move(compromised_credentials,
|
||||
std::back_inserter(compromised_credentials_));
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/metrics/field_trial.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/autofill/core/browser/autofill_client.h"
|
||||
#include "components/autofill/core/browser/autofill_driver.h"
|
||||
@ -309,7 +309,7 @@ std::vector<autofill::Suggestion> SetUnlockLoadingState(
|
||||
void LogAccountStoredPasswordsCountInFillDataAfterUnlock(
|
||||
const autofill::PasswordFormFillData& fill_data) {
|
||||
int account_store_passwords_count =
|
||||
util::ranges::count_if(fill_data.additional_logins,
|
||||
base::ranges::count_if(fill_data.additional_logins,
|
||||
[](const autofill::PasswordAndMetadata& metadata) {
|
||||
return metadata.uses_account_store;
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h"
|
||||
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "components/password_manager/core/browser/android_affiliation/affiliation_fetcher.h"
|
||||
#include "components/password_manager/core/browser/password_store_factory_util.h"
|
||||
#include "components/sync/driver/sync_service.h"
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "components/autofill/core/common/password_form.h"
|
||||
|
||||
namespace password_manager {
|
||||
@ -70,7 +70,7 @@ void CompromisedCredentialsReader::OnGetCompromisedCredentialsFrom(
|
||||
return credential.in_store == to_remove;
|
||||
});
|
||||
|
||||
util::ranges::move(compromised_credentials,
|
||||
base::ranges::move(compromised_credentials,
|
||||
std::back_inserter(compromised_credentials_));
|
||||
|
||||
// Observers are reptitively notified of compromised credentials, and hence
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "components/autofill/core/common/password_form.h"
|
||||
|
||||
namespace password_manager {
|
||||
@ -41,7 +41,7 @@ void SavedPasswordsPresenter::Init() {
|
||||
|
||||
bool SavedPasswordsPresenter::EditPassword(const autofill::PasswordForm& form,
|
||||
base::string16 new_password) {
|
||||
auto found = util::ranges::find(passwords_, form);
|
||||
auto found = base::ranges::find(passwords_, form);
|
||||
if (found == passwords_.end())
|
||||
return false;
|
||||
|
||||
@ -108,7 +108,7 @@ void SavedPasswordsPresenter::OnGetPasswordStoreResultsFrom(
|
||||
});
|
||||
|
||||
// Profile store passwords are always stored first in `passwords_`.
|
||||
auto account_passwords_it = util::ranges::partition_point(
|
||||
auto account_passwords_it = base::ranges::partition_point(
|
||||
passwords_,
|
||||
[](auto& password) { return !password.IsUsingAccountStore(); });
|
||||
if (store == profile_store_) {
|
||||
@ -118,7 +118,7 @@ void SavedPasswordsPresenter::OnGetPasswordStoreResultsFrom(
|
||||
new_passwords.reserve(results.size() + passwords_.end() -
|
||||
account_passwords_it);
|
||||
auto new_passwords_back_inserter = std::back_inserter(new_passwords);
|
||||
util::ranges::transform(results, new_passwords_back_inserter,
|
||||
base::ranges::transform(results, new_passwords_back_inserter,
|
||||
[](auto& result) { return std::move(*result); });
|
||||
std::move(account_passwords_it, passwords_.end(),
|
||||
new_passwords_back_inserter);
|
||||
@ -129,7 +129,7 @@ void SavedPasswordsPresenter::OnGetPasswordStoreResultsFrom(
|
||||
passwords_.erase(account_passwords_it, passwords_.end());
|
||||
if (passwords_.capacity() < passwords_.size() + results.size())
|
||||
passwords_.reserve(passwords_.size() + results.size());
|
||||
util::ranges::transform(results, std::back_inserter(passwords_),
|
||||
base::ranges::transform(results, std::back_inserter(passwords_),
|
||||
[](auto& result) { return std::move(*result); });
|
||||
}
|
||||
NotifySavedPasswordsChanged();
|
||||
|
@ -71,7 +71,6 @@ executable("make_top_domain_list_variables") {
|
||||
":common",
|
||||
"//base",
|
||||
"//base:i18n",
|
||||
"//base/util/ranges:ranges",
|
||||
"//components/url_formatter/spoof_checks/common_words:common",
|
||||
"//third_party/icu",
|
||||
]
|
||||
|
@ -30,10 +30,10 @@
|
||||
#include "base/i18n/icu_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/url_formatter/spoof_checks/common_words/common_words_util.h"
|
||||
#include "components/url_formatter/spoof_checks/top_domains/top_domain_util.h"
|
||||
@ -74,7 +74,7 @@ std::string GetSkeleton(const std::string& domain,
|
||||
}
|
||||
|
||||
bool ContainsOnlyDigits(const std::string& text) {
|
||||
return util::ranges::all_of(text.begin(), text.end(), ::isdigit);
|
||||
return base::ranges::all_of(text.begin(), text.end(), ::isdigit);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -48,7 +48,6 @@ source_set("browser") {
|
||||
"//base:base_static",
|
||||
"//base:clang_profiling_buildflags",
|
||||
"//base/third_party/dynamic_annotations",
|
||||
"//base/util/ranges:ranges",
|
||||
"//build:branding_buildflags",
|
||||
"//build:chromecast_buildflags",
|
||||
"//build:chromeos_buildflags",
|
||||
|
@ -9,10 +9,10 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/numerics/ranges.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/url_formatter/url_formatter.h"
|
||||
#include "content/browser/media/session/audio_focus_delegate.h"
|
||||
@ -1540,7 +1540,7 @@ bool MediaSessionImpl::IsAudioOutputDeviceSwitchingSupported() const {
|
||||
if (normal_players_.empty())
|
||||
return false;
|
||||
|
||||
return util::ranges::all_of(normal_players_, [](const auto& player) {
|
||||
return base::ranges::all_of(normal_players_, [](const auto& player) {
|
||||
return player.first.observer->SupportsAudioOutputDeviceSwitching(
|
||||
player.first.player_id);
|
||||
});
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "content/browser/renderer_host/frame_tree.h"
|
||||
#include "content/browser/renderer_host/frame_tree_node.h"
|
||||
#include "content/browser/renderer_host/navigation_request.h"
|
||||
@ -83,7 +83,7 @@ void RecordXFrameOptionsUsage(XFrameOptionsHistogram usage) {
|
||||
|
||||
bool HeadersContainFrameAncestorsCSP(
|
||||
const network::mojom::ParsedHeadersPtr& headers) {
|
||||
return util::ranges::any_of(
|
||||
return base::ranges::any_of(
|
||||
headers->content_security_policy, [](const auto& csp) {
|
||||
return csp->header->type ==
|
||||
network::mojom::ContentSecurityPolicyType::kEnforce &&
|
||||
|
@ -141,7 +141,6 @@ component("cpp") {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//base/util/ranges:ranges",
|
||||
"//components/prefs",
|
||||
"//ipc",
|
||||
"//services/proxy_resolver/public/mojom",
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "services/network/public/cpp/content_security_policy/csp_context.h"
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source.h"
|
||||
@ -721,7 +721,7 @@ void AddContentSecurityPolicyFromHeader(base::StringPiece header,
|
||||
header.as_string(), type, mojom::ContentSecurityPolicySource::kHTTP);
|
||||
|
||||
for (auto directive : directives) {
|
||||
if (!util::ranges::all_of(directive.first, IsDirectiveNameCharacter)) {
|
||||
if (!base::ranges::all_of(directive.first, IsDirectiveNameCharacter)) {
|
||||
out->parsing_errors.emplace_back(base::StringPrintf(
|
||||
"The Content-Security-Policy directive name '%s' contains one or "
|
||||
"more invalid characters. Only ASCII alphanumeric characters or "
|
||||
@ -730,7 +730,7 @@ void AddContentSecurityPolicyFromHeader(base::StringPiece header,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!util::ranges::all_of(directive.second, IsDirectiveValueCharacter)) {
|
||||
if (!base::ranges::all_of(directive.second, IsDirectiveValueCharacter)) {
|
||||
out->parsing_errors.emplace_back(base::StringPrintf(
|
||||
"The value for the Content-Security-Policy directive '%s' contains "
|
||||
"one or more invalid characters. Non-whitespace characters outside "
|
||||
@ -903,8 +903,8 @@ bool PluginTypesSubsumes(
|
||||
}
|
||||
|
||||
// Check that every plugin-type in |types_b| is allowed by |types_a|.
|
||||
return util::ranges::all_of(types_b.value(), [&](const std::string& type_b) {
|
||||
return util::ranges::any_of(
|
||||
return base::ranges::all_of(types_b.value(), [&](const std::string& type_b) {
|
||||
return base::ranges::any_of(
|
||||
policy_a.plugin_types.value(),
|
||||
[&](const std::string& type_a) { return type_a == type_b; });
|
||||
});
|
||||
@ -1115,7 +1115,7 @@ bool Subsumes(const mojom::ContentSecurityPolicy& policy_a,
|
||||
CSPDirectiveName::FrameAncestors, CSPDirectiveName::FormAction,
|
||||
CSPDirectiveName::NavigateTo};
|
||||
|
||||
return util::ranges::all_of(directives, [&](CSPDirectiveName directive) {
|
||||
return base::ranges::all_of(directives, [&](CSPDirectiveName directive) {
|
||||
auto required = GetSourceList(directive, policy_a);
|
||||
if (!required.second)
|
||||
return true;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source_list.h"
|
||||
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
|
||||
#include "services/network/public/cpp/content_security_policy/csp_context.h"
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source.h"
|
||||
@ -177,8 +177,8 @@ bool UrlSourceListSubsumes(
|
||||
|
||||
// Every item in |source_list_b| must be subsumed by at least one item in
|
||||
// |source_list_a|.
|
||||
return util::ranges::all_of(source_list_b, [&](const auto& source_b) {
|
||||
return util::ranges::any_of(source_list_a, [&](const auto& source_a) {
|
||||
return base::ranges::all_of(source_list_b, [&](const auto& source_b) {
|
||||
return base::ranges::any_of(source_list_a, [&](const auto& source_a) {
|
||||
return CSPSourceSubsumes(source_a, source_b);
|
||||
});
|
||||
});
|
||||
|
@ -162,7 +162,6 @@ source_set("tests") {
|
||||
":trust_tokens",
|
||||
"//base",
|
||||
"//base/test:test_support",
|
||||
"//base/util/ranges",
|
||||
"//components/cbor",
|
||||
"//components/sqlite_proto",
|
||||
"//net",
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/test/bind_test_util.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "base/time/time_to_iso8601.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "components/cbor/reader.h"
|
||||
#include "components/cbor/values.h"
|
||||
#include "components/cbor/writer.h"
|
||||
@ -670,7 +670,7 @@ TEST_F(TrustTokenRequestSigningHelperTest, CatchesSignatureFailure) {
|
||||
EXPECT_THAT(*my_request, Not(Header("Sec-Time")));
|
||||
EXPECT_THAT(*my_request, Not(Header("Sec-Signature")));
|
||||
EXPECT_THAT(*my_request, Header("Sec-Signed-Redemption-Record", IsEmpty()));
|
||||
EXPECT_TRUE(util::ranges::any_of(
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
net_log.GetEntriesWithType(
|
||||
net::NetLogEventType::TRUST_TOKEN_OPERATION_BEGIN_SIGNING),
|
||||
[](const net::NetLogEntry& entry) {
|
||||
|
@ -408,7 +408,7 @@ absl::InlinedVector, absl::FixedArray</code></td>
|
||||
<td><code>auto it = absl::c_find(container, value);</code></td>
|
||||
<td>Container-based versions of algorithmic functions within C++ standard library.</td>
|
||||
<td><a href="https://source.chromium.org/chromium/chromium/src/+/master:third_party/abseil-cpp/absl/algorithm/container.h">container.h</a></td>
|
||||
<td>Overlaps with <code>base/util/ranges/algorithm.h</code>.</td>
|
||||
<td>Overlaps with <code>base/ranges/algorithm.h</code>.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -480,7 +480,6 @@ component("views") {
|
||||
deps = [
|
||||
"//base:i18n",
|
||||
"//base/third_party/dynamic_annotations",
|
||||
"//base/util/ranges",
|
||||
"//cc/paint",
|
||||
"//mojo/public/cpp/bindings",
|
||||
"//skia",
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/util/ranges/algorithm.h"
|
||||
#include "ui/accessibility/ax_enums.mojom.h"
|
||||
#include "ui/accessibility/ax_node_data.h"
|
||||
#include "ui/gfx/font_list.h"
|
||||
@ -315,7 +315,7 @@ void StyledLabel::ClearStyleRanges() {
|
||||
|
||||
void StyledLabel::ClickLinkForTesting() {
|
||||
const auto it =
|
||||
util::ranges::find(children(), Link::kViewClassName, &View::GetClassName);
|
||||
base::ranges::find(children(), Link::kViewClassName, &View::GetClassName);
|
||||
DCHECK(it != children().cend());
|
||||
(*it)->OnKeyPressed(
|
||||
ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE));
|
||||
|
Reference in New Issue
Block a user