0

[cleanup] Replace base::ranges with std::ranges: components/

Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I7377af2f9c3758c68a249b421d98bd3fd5c2c1fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6201377
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1411730}
This commit is contained in:
Peter Kasting
2025-01-27 10:38:22 -08:00
committed by Chromium LUCI CQ
parent c97fafc319
commit ccea09835f
580 changed files with 1960 additions and 1965 deletions
components
account_manager_core
affiliations
aggregation_service
allocation_recorder
android_autofill
app_restore
attribution_reporting
autofill
content
core
browser
autofill_merge_unittest.cc
crowdsourcing
data_manager
data_model
data_quality
field_type_utils.cc
filling
form_import
form_parsing
form_processing
form_structure.ccform_structure_rationalization_engine_unittest.ccform_structure_rationalizer.ccform_structure_sectioning_util.cc
foundations
geo
heuristic_classification_unittests.cc
integrators
logging
manual_testing_import.cc
metrics
ml_model
payments
strike_databases
studies
suggestions
test_utils
ui
webdata
common
ios
autofill_ai
base32
bookmarks
browser_sync
browser_ui
site_settings
browsing_data
browsing_topics
cast_receiver
cast_streaming
client_update_protocol
commerce
component_updater
content_settings
continuous_search
crash
custom_handlers
data_sharing
desks_storage
device_event_log
discardable_memory
dom_distiller
download
drive
enterprise
exo
facilitated_payments
favicon
favicon_base
feed
feedback
gcm_driver
global_media_controls
history
history_clusters
history_embeddings
infobars
input
js_injection
keyed_service
language
lookalikes
media_effects
media_message_center
media_router
metrics
mirroring
no_state_prefetch
ntp_tiles
offline_items_collection
offline_pages
omnibox
optimization_guide
origin_trials
os_crypt
page_content_annotations
page_load_metrics
password_manager
content
core
browser
affiliation
credential_manager_impl_unittest.cccredential_manager_pending_request_task.ccfake_form_fetcher.cc
features
field_info_manager.cc
form_parsing
generation
http_password_store_migrator_unittest.cc
import
leak_detection
leak_detection_delegate_helper.ccleak_detection_dialog_utils_unittest.ccpassword_autofill_manager.ccpassword_credential_filler_impl_unittest.ccpassword_form.ccpassword_form_cache_impl.ccpassword_form_filling_unittest.ccpassword_form_manager.ccpassword_form_metrics_recorder.ccpassword_generation_manager.ccpassword_manager.ccpassword_manager_test_utils.ccpassword_manager_util.ccpassword_manager_util_unittest.ccpassword_manual_fallback_flow.ccpassword_reuse_detector_impl.ccpassword_reuse_detector_impl_unittest.ccpassword_save_manager_impl.cc
password_store
password_suggestion_generator.cc
sharing
store_metrics_reporter.cc
sync
ui
votes_uploader.cc
common
ios
payments
pdf
performance_manager
permissions
plus_addresses
policy
power_bookmarks
prefs
privacy_sandbox
query_parser
remote_cocoa
safe_browsing
safe_search_api
saved_tab_groups
search_engines
security_interstitials
segmentation_platform
services
sessions
shared_highlighting
signin
spellcheck
subresource_filter
supervised_user
sync
sync_bookmarks
sync_device_info
sync_sessions
tracing
translate
trusted_vault
ui_devtools
ukm
undo
unexportable_keys
unified_consent
update_client
url_formatter
url_matcher
url_pattern
url_pattern_index
url_rewrite
user_education
user_manager
user_notes
variations
visited_url_ranking
viz
web_modal
web_package
webauthn
webcrypto
webrtc
zucchini

@ -106,7 +106,7 @@ UserDirectoryIntegrityManager::GetMisconfiguredUserAccountIdLegacy() {
UserList users = UserManager::Get()->GetUsers();
auto misconfigured_user_it =
base::ranges::find_if(users, [&misconfigured_user_email](User* user) {
std::ranges::find_if(users, [&misconfigured_user_email](User* user) {
return user->GetAccountId().GetUserEmail() ==
misconfigured_user_email.value();
});

@ -6,6 +6,7 @@
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <optional>
#include <set>
@ -26,7 +27,6 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
@ -357,8 +357,8 @@ void UserManagerImpl::UserLoggedIn(const AccountId& account_id,
if (active_user_->HasGaiaAccount()) {
// Move the user to the front of the list.
auto it = base::ranges::find(users_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
auto it = std::ranges::find(users_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
if (it != users_.end()) {
std::rotate(users_.begin(), it, it + 1);
ScopedListPrefUpdate prefs_users_update(local_state_.get(),
@ -490,7 +490,7 @@ bool UserManagerImpl::UpdateDeviceLocalAccountUser(
// Non device local account is not a target to be removed.
continue;
}
if (base::ranges::any_of(
if (std::ranges::any_of(
device_local_accounts, [user](const DeviceLocalAccountInfo& info) {
return info.user_id == user->GetAccountId().GetUserEmail() &&
info.type == user->GetType();
@ -1499,8 +1499,8 @@ bool UserManagerImpl::OnUserProfileCreated(const AccountId& account_id,
// Find a User from `user_storage_`.
// FindUserAndModify may overlook some existing User instance, because
// the list may not contain ephemeral users that are getting stale.
auto it = base::ranges::find(user_storage_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
auto it = std::ranges::find(user_storage_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
auto* user = it == user_storage_.end() ? nullptr : it->get();
CHECK(user);
if (user->is_profile_created()) {
@ -1529,8 +1529,8 @@ void UserManagerImpl::OnUserProfileWillBeDestroyed(
const AccountId& account_id) {
// Find from user_stroage_. See OnUserProfileCreated for the reason why not
// using FindUserAndModify.
auto it = base::ranges::find(user_storage_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
auto it = std::ranges::find(user_storage_, account_id,
[](auto& ptr) { return ptr->GetAccountId(); });
auto* user = it == user_storage_.end() ? nullptr : it->get();
CHECK(user);
@ -1702,7 +1702,7 @@ void UserManagerImpl::SetLRUUser(User* user) {
user->GetAccountId().GetUserEmail());
local_state_->CommitPendingWrite();
UserList::iterator it = base::ranges::find(lru_logged_in_users_, user);
UserList::iterator it = std::ranges::find(lru_logged_in_users_, user);
if (it != lru_logged_in_users_.end()) {
lru_logged_in_users_.erase(it);
}