Migrate ios/chrome from base::Bind to BindOnce/Repeating
This is part of the base::Callback migration.
Context: https://cs.chromium.org/chromium/src/docs/callback.md?rcl=9fcc3764aea8f97e9f6de4a9ee61d554e67edcda&l=40
Bug: 1007792
Change-Id: I16c66d31f3c95b179288d2586682d981d0b4f7a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505946
Commit-Queue: Renjie Tang <[email protected]>
Auto-Submit: Renjie Tang <[email protected]>
Reviewed-by: David Roger <[email protected]>
Cr-Commit-Position: refs/heads/master@{#823378}
diff --git a/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm b/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm
index 32d5e45..014f93d5 100644
--- a/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm
+++ b/ios/chrome/app/application_delegate/memory_warning_helper_unittest.mm
@@ -26,8 +26,9 @@
// will store the memory pressure level sent to the callback in
// |memory_pressure_level_| so that tests can verify the level is correct.
memory_pressure_listener_.reset(new base::MemoryPressureListener(
- FROM_HERE, base::Bind(&MemoryWarningHelperTest::OnMemoryPressure,
- base::Unretained(this))));
+ FROM_HERE,
+ base::BindRepeating(&MemoryWarningHelperTest::OnMemoryPressure,
+ base::Unretained(this))));
memory_pressure_level_ =
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE;
}
diff --git a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
index 6b558fb..d0d767bd 100644
--- a/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
+++ b/ios/chrome/app/spotlight/topsites_spotlight_manager.mm
@@ -188,9 +188,10 @@
_suggestionsBridge.reset(new SpotlightSuggestionsBridge(self));
_syncService = syncService;
_suggestionService = suggestionsService;
- _suggestionsServiceResponseSubscription = _suggestionService->AddCallback(
- base::Bind(&SpotlightSuggestionsBridge::OnSuggestionsProfileAvailable,
- _suggestionsBridge->AsWeakPtr()));
+ _suggestionsServiceResponseSubscription =
+ _suggestionService->AddCallback(base::BindRepeating(
+ &SpotlightSuggestionsBridge::OnSuggestionsProfileAvailable,
+ _suggestionsBridge->AsWeakPtr()));
_syncObserverBridge.reset(new SyncObserverBridge(self, syncService));
}
}
@@ -218,9 +219,9 @@
}
- (void)addAllLocalTopSitesItems {
- _topSites->GetMostVisitedURLs(
- base::Bind(&SpotlightTopSitesCallbackBridge::OnMostVisitedURLsAvailable,
- _topSitesCallbackBridge->AsWeakPtr()));
+ _topSites->GetMostVisitedURLs(base::BindOnce(
+ &SpotlightTopSitesCallbackBridge::OnMostVisitedURLsAvailable,
+ _topSitesCallbackBridge->AsWeakPtr()));
}
- (void)addAllSuggestionsTopSitesItems {
diff --git a/ios/chrome/browser/application_context_impl.mm b/ios/chrome/browser/application_context_impl.mm
index c8ebd42..fcb2a5f6 100644
--- a/ios/chrome/browser/application_context_impl.mm
+++ b/ios/chrome/browser/application_context_impl.mm
@@ -451,8 +451,8 @@
(channel != version_info::Channel::STABLE &&
channel != version_info::Channel::BETA);
browser_policy_connector_ = std::make_unique<BrowserPolicyConnectorIOS>(
- base::Bind(&BuildPolicyHandlerList,
- enable_future_policies_without_allowlist));
+ base::BindRepeating(&BuildPolicyHandlerList,
+ enable_future_policies_without_allowlist));
// Install a mock platform policy provider, if running under EG2 and one
// is supplied.
diff --git a/ios/chrome/browser/device_sharing/device_sharing_manager_impl.mm b/ios/chrome/browser/device_sharing/device_sharing_manager_impl.mm
index 83a6d3a..14607f0 100644
--- a/ios/chrome/browser/device_sharing/device_sharing_manager_impl.mm
+++ b/ios/chrome/browser/device_sharing/device_sharing_manager_impl.mm
@@ -22,8 +22,8 @@
prefs_change_observer_->Init(browser_state_->GetPrefs());
prefs_change_observer_->Add(
prefs::kIosHandoffToOtherDevices,
- base::Bind(&DeviceSharingManagerImpl::UpdateHandoffManager,
- base::Unretained(this)));
+ base::BindRepeating(&DeviceSharingManagerImpl::UpdateHandoffManager,
+ base::Unretained(this)));
UpdateHandoffManager();
[handoff_manager_ updateActiveURL:GURL()];
}
diff --git a/ios/chrome/browser/dom_distiller/distiller_viewer.cc b/ios/chrome/browser/dom_distiller/distiller_viewer.cc
index 8e4e1dd..dbda6d0 100644
--- a/ios/chrome/browser/dom_distiller/distiller_viewer.cc
+++ b/ios/chrome/browser/dom_distiller/distiller_viewer.cc
@@ -47,9 +47,10 @@
distiller_ = distiller_factory->CreateDistillerForUrl(url);
distiller_->DistillPage(
url, std::move(page),
- base::Bind(&DistillerViewer::OnDistillerFinished, base::Unretained(this)),
- base::Bind(&DistillerViewer::OnArticleDistillationUpdated,
- base::Unretained(this)));
+ base::BindOnce(&DistillerViewer::OnDistillerFinished,
+ base::Unretained(this)),
+ base::BindRepeating(&DistillerViewer::OnArticleDistillationUpdated,
+ base::Unretained(this)));
}
DistillerViewer::~DistillerViewer() {}
diff --git a/ios/chrome/browser/external_files/external_file_remover_impl.mm b/ios/chrome/browser/external_files/external_file_remover_impl.mm
index dae010ca..caf90b3c 100644
--- a/ios/chrome/browser/external_files/external_file_remover_impl.mm
+++ b/ios/chrome/browser/external_files/external_file_remover_impl.mm
@@ -227,7 +227,7 @@
base::ThreadPool::PostTaskAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&RemoveFilesWithOptions, referenced_files, age_in_days),
- base::Bind(&RunCallback, base::Passed(&closure_runner)));
+ base::BindOnce(&RunCallback, base::Passed(&closure_runner)));
}
NSSet* ExternalFileRemoverImpl::GetReferencedExternalFiles() {
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm
index 64f7aa0..94b0b5a 100644
--- a/ios/chrome/browser/flags/about_flags.mm
+++ b/ios/chrome/browser/flags/about_flags.mm
@@ -865,7 +865,7 @@
base::ListValue* unsupported_entries) {
GetGlobalFlagsState().GetFlagFeatureEntries(
flags_storage, access, supported_entries, unsupported_entries,
- base::Bind(&SkipConditionalFeatureEntry));
+ base::BindRepeating(&SkipConditionalFeatureEntry));
}
void SetFeatureEntryEnabled(flags_ui::FlagsStorage* flags_storage,
diff --git a/ios/chrome/browser/history/history_client_impl.cc b/ios/chrome/browser/history/history_client_impl.cc
index 72be504..8033e9d 100644
--- a/ios/chrome/browser/history/history_client_impl.cc
+++ b/ios/chrome/browser/history/history_client_impl.cc
@@ -35,12 +35,12 @@
history::HistoryService* history_service) {
if (bookmark_model_) {
on_bookmarks_removed_ =
- base::Bind(&history::HistoryService::URLsNoLongerBookmarked,
- base::Unretained(history_service));
+ base::BindRepeating(&history::HistoryService::URLsNoLongerBookmarked,
+ base::Unretained(history_service));
favicons_changed_subscription_ =
history_service->AddFaviconsChangedCallback(
- base::Bind(&bookmarks::BookmarkModel::OnFaviconsChanged,
- base::Unretained(bookmark_model_)));
+ base::BindRepeating(&bookmarks::BookmarkModel::OnFaviconsChanged,
+ base::Unretained(bookmark_model_)));
}
}
diff --git a/ios/chrome/browser/history/history_client_impl.h b/ios/chrome/browser/history/history_client_impl.h
index c73b9ad..b12c7c04 100644
--- a/ios/chrome/browser/history/history_client_impl.h
+++ b/ios/chrome/browser/history/history_client_impl.h
@@ -56,7 +56,7 @@
bookmarks::BookmarkModel* bookmark_model_;
// Callback invoked when URLs are removed from BookmarkModel.
- base::Callback<void(const std::set<GURL>&)> on_bookmarks_removed_;
+ base::RepeatingCallback<void(const std::set<GURL>&)> on_bookmarks_removed_;
// Subscription for notifications of changes to favicons.
std::unique_ptr<
diff --git a/ios/chrome/browser/history/top_sites_factory.cc b/ios/chrome/browser/history/top_sites_factory.cc
index 321af7f2..1666c6a 100644
--- a/ios/chrome/browser/history/top_sites_factory.cc
+++ b/ios/chrome/browser/history/top_sites_factory.cc
@@ -51,9 +51,10 @@
history::HistoryService* history_service =
ios::HistoryServiceFactory::GetForBrowserState(
browser_state, ServiceAccessType::EXPLICIT_ACCESS);
- scoped_refptr<history::TopSitesImpl> top_sites(new history::TopSitesImpl(
- browser_state->GetPrefs(), history_service,
- history::PrepopulatedPageList(), base::Bind(CanAddURLToHistory)));
+ scoped_refptr<history::TopSitesImpl> top_sites(
+ new history::TopSitesImpl(browser_state->GetPrefs(), history_service,
+ history::PrepopulatedPageList(),
+ base::BindRepeating(CanAddURLToHistory)));
top_sites->Init(
browser_state->GetStatePath().Append(history::kTopSitesFilename));
return top_sites;
diff --git a/ios/chrome/browser/metrics/first_user_action_recorder.cc b/ios/chrome/browser/metrics/first_user_action_recorder.cc
index 8f00d380..2e4b9276 100644
--- a/ios/chrome/browser/metrics/first_user_action_recorder.cc
+++ b/ios/chrome/browser/metrics/first_user_action_recorder.cc
@@ -100,8 +100,9 @@
recorded_action_(false),
action_pending_(false),
background_duration_(background_duration),
- action_callback_(base::Bind(&FirstUserActionRecorder::OnUserAction,
- base::Unretained(this))) {
+ action_callback_(
+ base::BindRepeating(&FirstUserActionRecorder::OnUserAction,
+ base::Unretained(this))) {
base::AddActionCallback(action_callback_);
}
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm
index d4e045e..6904a70 100644
--- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm
@@ -401,12 +401,13 @@
bool IOSChromeMetricsServiceClient::RegisterForNotifications() {
tab_parented_subscription_ =
TabParentingGlobalObserver::GetInstance()->RegisterCallback(
- base::Bind(&IOSChromeMetricsServiceClient::OnTabParented,
- base::Unretained(this)));
+ base::BindRepeating(&IOSChromeMetricsServiceClient::OnTabParented,
+ base::Unretained(this)));
omnibox_url_opened_subscription_ =
OmniboxEventGlobalTracker::GetInstance()->RegisterCallback(
- base::Bind(&IOSChromeMetricsServiceClient::OnURLOpenedFromOmnibox,
- base::Unretained(this)));
+ base::BindRepeating(
+ &IOSChromeMetricsServiceClient::OnURLOpenedFromOmnibox,
+ base::Unretained(this)));
std::vector<ChromeBrowserState*> loaded_browser_states =
GetApplicationContext()
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm
index 35a815d..a6b49c0d 100644
--- a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm
@@ -69,7 +69,7 @@
DCHECK(thread_checker_.CalledOnValidThread());
return std::make_unique<rappor::RapporServiceImpl>(
local_state_,
- base::Bind(
+ base::BindRepeating(
&IOSChromeMetricsServicesManagerClient::AreIncognitoTabsPresent));
}
@@ -100,8 +100,8 @@
if (!metrics_state_manager_) {
metrics_state_manager_ = metrics::MetricsStateManager::Create(
local_state_, enabled_state_provider_.get(), base::string16(),
- base::Bind(&PostStoreMetricsClientInfo),
- base::Bind(&LoadMetricsClientInfo));
+ base::BindRepeating(&PostStoreMetricsClientInfo),
+ base::BindRepeating(&LoadMetricsClientInfo));
}
return metrics_state_manager_.get();
}
diff --git a/ios/chrome/browser/omaha/omaha_service.h b/ios/chrome/browser/omaha/omaha_service.h
index 720ecbbf..902f8c38 100644
--- a/ios/chrome/browser/omaha/omaha_service.h
+++ b/ios/chrome/browser/omaha/omaha_service.h
@@ -56,7 +56,7 @@
// Returns debug information about the omaha service.
static void GetDebugInformation(
- const base::Callback<void(base::DictionaryValue*)> callback);
+ base::OnceCallback<void(base::DictionaryValue*)> callback);
private:
// For tests:
@@ -152,7 +152,7 @@
// Computes debugging information and fill |result|.
void GetDebugInformationOnIOThread(
- const base::Callback<void(base::DictionaryValue*)> callback);
+ base::OnceCallback<void(base::DictionaryValue*)> callback);
// Returns whether the next ping to send must a an install/update ping. If
// |true|, the next ping must use |GetInstallRetryRequestId| as identifier
diff --git a/ios/chrome/browser/omaha/omaha_service.mm b/ios/chrome/browser/omaha/omaha_service.mm
index e403c93a..ce04035a 100644
--- a/ios/chrome/browser/omaha/omaha_service.mm
+++ b/ios/chrome/browser/omaha/omaha_service.mm
@@ -469,18 +469,20 @@
// static
void OmahaService::GetDebugInformation(
- const base::Callback<void(base::DictionaryValue*)> callback) {
+ base::OnceCallback<void(base::DictionaryValue*)> callback) {
if (OmahaService::IsEnabled()) {
OmahaService* service = GetInstance();
- base::PostTask(FROM_HERE, {web::WebThread::IO},
- base::BindOnce(&OmahaService::GetDebugInformationOnIOThread,
- base::Unretained(service), callback));
+ base::PostTask(
+ FROM_HERE, {web::WebThread::IO},
+ base::BindOnce(&OmahaService::GetDebugInformationOnIOThread,
+ base::Unretained(service), std::move(callback)));
} else {
auto result = std::make_unique<base::DictionaryValue>();
// Invoke the callback with an empty response.
- base::PostTask(FROM_HERE, {web::WebThread::UI},
- base::BindOnce(callback, base::Owned(result.release())));
+ base::PostTask(
+ FROM_HERE, {web::WebThread::UI},
+ base::BindOnce(std::move(callback), base::Owned(result.release())));
}
}
@@ -773,7 +775,7 @@
}
void OmahaService::GetDebugInformationOnIOThread(
- const base::Callback<void(base::DictionaryValue*)> callback) {
+ base::OnceCallback<void(base::DictionaryValue*)> callback) {
auto result = std::make_unique<base::DictionaryValue>();
result->SetString("message", GetCurrentPingContent());
@@ -797,8 +799,9 @@
(timer_.desired_run_time() - base::TimeTicks::Now())));
// Sending the value to the callback.
- base::PostTask(FROM_HERE, {web::WebThread::UI},
- base::BindOnce(callback, base::Owned(result.release())));
+ base::PostTask(
+ FROM_HERE, {web::WebThread::UI},
+ base::BindOnce(std::move(callback), base::Owned(result.release())));
}
bool OmahaService::IsNextPingInstallRetry() {
diff --git a/ios/chrome/browser/omaha/omaha_service_unittest.mm b/ios/chrome/browser/omaha/omaha_service_unittest.mm
index 7efeb170..1ef240ca 100644
--- a/ios/chrome/browser/omaha/omaha_service_unittest.mm
+++ b/ios/chrome/browser/omaha/omaha_service_unittest.mm
@@ -146,8 +146,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(),
GetChannelString(), base::Time::Now(), OmahaService::USAGE_PING);
@@ -174,8 +174,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(),
GetChannelString(),
@@ -206,8 +206,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
CleanService(&service, "");
std::string content = service.GetPingContent(
"requestId", "sessionId", version_info::GetVersionNumber(),
@@ -244,8 +244,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -273,8 +273,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -294,8 +294,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -335,8 +335,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -368,8 +368,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
service.one_off_check_callback_ =
@@ -403,8 +403,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -440,8 +440,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
service.one_off_check_callback_ =
@@ -484,8 +484,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
service.one_off_check_callback_ =
@@ -526,8 +526,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -567,8 +567,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, "");
@@ -601,8 +601,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -648,8 +648,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -701,8 +701,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.number_of_tries_ = 5;
service.last_sent_time_ = now - base::TimeDelta::FromSeconds(1);
service.next_tries_time_ = now + base::TimeDelta::FromSeconds(2);
@@ -738,8 +738,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, "");
@@ -774,8 +774,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, version_info::GetVersionNumber());
@@ -809,8 +809,8 @@
OmahaService service(false);
service.StartInternal();
- service.set_upgrade_recommended_callback(
- base::Bind(&OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
+ service.set_upgrade_recommended_callback(base::BindRepeating(
+ &OmahaServiceTest::OnNeedUpdate, base::Unretained(this)));
service.InitializeURLLoaderFactory(test_shared_url_loader_factory_);
CleanService(&service, "");
diff --git a/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm b/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm
index 2a0b32b..1870ef7 100644
--- a/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm
+++ b/ios/chrome/browser/policy/configuration_policy_handler_list_factory.mm
@@ -101,8 +101,9 @@
DCHECK(IsEnterprisePolicyEnabled());
std::unique_ptr<policy::ConfigurationPolicyHandlerList> handlers =
std::make_unique<policy::ConfigurationPolicyHandlerList>(
- base::Bind(&PopulatePolicyHandlerParameters),
- base::Bind(&policy::GetChromePolicyDetails), allow_future_policies);
+ base::BindRepeating(&PopulatePolicyHandlerParameters),
+ base::BindRepeating(&policy::GetChromePolicyDetails),
+ allow_future_policies);
// Check the feature flag before adding handlers to the list.
if (!ShouldInstallEnterprisePolicyHandlers()) {
diff --git a/ios/chrome/browser/policy/enterprise_policy_test_helper.cc b/ios/chrome/browser/policy/enterprise_policy_test_helper.cc
index 74f9d68..5b78dca 100644
--- a/ios/chrome/browser/policy/enterprise_policy_test_helper.cc
+++ b/ios/chrome/browser/policy/enterprise_policy_test_helper.cc
@@ -23,8 +23,9 @@
// Create a BrowserPolicyConnectorIOS, install the mock policy
// provider, and hook up Local State.
- browser_policy_connector_ = std::make_unique<BrowserPolicyConnectorIOS>(
- base::Bind(&BuildPolicyHandlerList, /* allow_future_policies= */ true));
+ browser_policy_connector_ =
+ std::make_unique<BrowserPolicyConnectorIOS>(base::BindRepeating(
+ &BuildPolicyHandlerList, /* allow_future_policies= */ true));
browser_policy_connector_->SetPolicyProviderForTesting(&policy_provider_);
scoped_refptr<PrefRegistrySimple> local_state_registry(
diff --git a/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.cc b/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.cc
index ef93728..683d506 100644
--- a/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.cc
+++ b/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.cc
@@ -52,7 +52,7 @@
factory->set_user_prefs(base::MakeRefCounted<JsonPrefStore>(
pref_filename, std::unique_ptr<PrefFilter>(), pref_io_task_runner));
- factory->set_read_error_callback(base::Bind(&HandleReadError));
+ factory->set_read_error_callback(base::BindRepeating(&HandleReadError));
factory->SetPrefModelAssociatorClient(
IOSChromePrefModelAssociatorClient::GetInstance());
}
diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.cc b/ios/chrome/browser/reading_list/reading_list_download_service.cc
index b50f0b7..1637a70b 100644
--- a/ios/chrome/browser/reading_list/reading_list_download_service.cc
+++ b/ios/chrome/browser/reading_list/reading_list_download_service.cc
@@ -81,10 +81,10 @@
url_downloader_ = std::make_unique<URLDownloader>(
distiller_factory_.get(), distiller_page_factory_.get(), prefs,
chrome_profile_path, url_loader_factory,
- base::Bind(&ReadingListDownloadService::OnDownloadEnd,
- base::Unretained(this)),
- base::Bind(&ReadingListDownloadService::OnDeleteEnd,
- base::Unretained(this)));
+ base::BindRepeating(&ReadingListDownloadService::OnDownloadEnd,
+ base::Unretained(this)),
+ base::BindRepeating(&ReadingListDownloadService::OnDeleteEnd,
+ base::Unretained(this)));
GetApplicationContext()
->GetNetworkConnectionTracker()
@@ -174,9 +174,9 @@
FROM_HERE,
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
- base::Bind(&::CleanUpFiles, OfflineRoot(), processed_directories),
- base::Bind(&ReadingListDownloadService::DownloadUnprocessedEntries,
- base::Unretained(this), unprocessed_entries));
+ base::BindOnce(&::CleanUpFiles, OfflineRoot(), processed_directories),
+ base::BindOnce(&ReadingListDownloadService::DownloadUnprocessedEntries,
+ base::Unretained(this), unprocessed_entries));
}
void ReadingListDownloadService::DownloadUnprocessedEntries(
diff --git a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
index 67e08a2..8d6b8e1 100644
--- a/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
+++ b/ios/chrome/browser/reading_list/reading_list_web_state_observer.mm
@@ -164,7 +164,7 @@
base::TimeDelta::FromMilliseconds(1500);
timer_->Start(
FROM_HERE, kDelayUntilLoadingProgressIsChecked,
- base::Bind(
+ base::BindRepeating(
&ReadingListWebStateObserver::VerifyIfReadingListEntryStartedLoading,
base::Unretained(this)));
}
diff --git a/ios/chrome/browser/reading_list/url_downloader.cc b/ios/chrome/browser/reading_list/url_downloader.cc
index 5154007..7d391a9 100644
--- a/ios/chrome/browser/reading_list/url_downloader.cc
+++ b/ios/chrome/browser/reading_list/url_downloader.cc
@@ -103,7 +103,7 @@
SuccessState success) {
DCHECK(working_);
- auto post_delete = base::Bind(
+ auto post_delete = base::BindOnce(
[](URLDownloader* _this, const GURL& url, const std::string& title,
const base::FilePath& offline_path, SuccessState success) {
_this->download_completion_.Run(url, _this->distilled_url_, success,
@@ -121,14 +121,14 @@
reading_list::OfflineURLDirectoryAbsolutePath(base_directory_, url);
task_tracker_.PostTaskAndReply(
task_runner_.get(), FROM_HERE,
- base::Bind(
+ base::BindOnce(
[](const base::FilePath& offline_directory_path) {
base::DeletePathRecursively(offline_directory_path);
},
directory_path),
- post_delete);
+ std::move(post_delete));
} else {
- post_delete.Run();
+ std::move(post_delete).Run();
}
}
@@ -182,7 +182,8 @@
distiller_.reset(new dom_distiller::DistillerViewer(
distiller_factory_, std::move(reading_list_distiller_page), pref_service_,
url,
- base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this))));
+ base::BindRepeating(&URLDownloader::DistillerCallback,
+ base::Unretained(this))));
}
void URLDownloader::DistilledPageRedirectedToURL(const GURL& page_url,
diff --git a/ios/chrome/browser/reading_list/url_downloader.h b/ios/chrome/browser/reading_list/url_downloader.h
index 2915ff0b..45ccb55 100644
--- a/ios/chrome/browser/reading_list/url_downloader.h
+++ b/ios/chrome/browser/reading_list/url_downloader.h
@@ -55,7 +55,7 @@
// A completion callback that takes a GURL and a bool indicating the
// outcome and returns void.
- using SuccessCompletion = base::Callback<void(const GURL&, bool)>;
+ using SuccessCompletion = base::RepeatingCallback<void(const GURL&, bool)>;
// A download completion callback that takes, in order, the GURL that was
// downloaded, the GURL of the page that was downloaded after redirections, a
@@ -64,12 +64,12 @@
// the url, and returns void.
// The path to downloaded file and title should not be used in case of
// failure.
- using DownloadCompletion = base::Callback<void(const GURL&,
- const GURL&,
- SuccessState,
- const base::FilePath&,
- int64_t size,
- const std::string&)>;
+ using DownloadCompletion = base::RepeatingCallback<void(const GURL&,
+ const GURL&,
+ SuccessState,
+ const base::FilePath&,
+ int64_t size,
+ const std::string&)>;
// Create a URL downloader with completion callbacks for downloads and
// deletions. The completion callbacks will be called with the original url
diff --git a/ios/chrome/browser/reading_list/url_downloader_unittest.mm b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
index d767861..da342e9 100644
--- a/ios/chrome/browser/reading_list/url_downloader_unittest.mm
+++ b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
@@ -76,10 +76,10 @@
nullptr,
path,
std::move(url_loader_factory),
- base::Bind(&MockURLDownloader::OnEndDownload,
- base::Unretained(this)),
- base::Bind(&MockURLDownloader::OnEndRemove,
- base::Unretained(this))),
+ base::BindRepeating(&MockURLDownloader::OnEndDownload,
+ base::Unretained(this)),
+ base::BindRepeating(&MockURLDownloader::OnEndRemove,
+ base::Unretained(this))),
html_("html") {}
void ClearCompletionTrackers() {
@@ -120,7 +120,8 @@
saved_size_ = 0;
distiller_.reset(new DistillerViewerTest(
url,
- base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this)),
+ base::BindRepeating(&URLDownloader::DistillerCallback,
+ base::Unretained(this)),
this, html_, redirect_url_, mime_type_));
}
diff --git a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
index 716e0a19..c8edbdc 100644
--- a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
+++ b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.cc
@@ -107,8 +107,8 @@
on_omnibox_search_callback_ = std::move(callback);
on_omnibox_url_opened_subscription_ =
OmniboxEventGlobalTracker::GetInstance()->RegisterCallback(
- base::Bind(&RLZTrackerDelegateImpl::OnURLOpenedFromOmnibox,
- base::Unretained(this)));
+ base::BindRepeating(&RLZTrackerDelegateImpl::OnURLOpenedFromOmnibox,
+ base::Unretained(this)));
}
void RLZTrackerDelegateImpl::SetHomepageSearchCallback(
diff --git a/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm b/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm
index 23ac2d9..be55e60 100644
--- a/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm
+++ b/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm
@@ -27,7 +27,8 @@
resource_type,
base::MakeRefCounted<UrlCheckerDelegateImpl>(
/*database_manager=*/nullptr),
- base::Bind([]() { return static_cast<web::WebState*>(nullptr); }),
+ base::BindRepeating(
+ []() { return static_cast<web::WebState*>(nullptr); }),
/*real_time_lookup_enabled=*/false,
/*can_rt_check_subresource_url=*/false,
/*url_lookup_service_on_ui=*/nullptr) {}
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_service_impl.mm b/ios/chrome/browser/safe_browsing/safe_browsing_service_impl.mm
index eda61e2b..45f5382 100644
--- a/ios/chrome/browser/safe_browsing/safe_browsing_service_impl.mm
+++ b/ios/chrome/browser/safe_browsing/safe_browsing_service_impl.mm
@@ -85,8 +85,9 @@
pref_change_registrar_->Init(prefs);
pref_change_registrar_->Add(
prefs::kSafeBrowsingEnabled,
- base::Bind(&SafeBrowsingServiceImpl::UpdateSafeBrowsingEnabledState,
- base::Unretained(this)));
+ base::BindRepeating(
+ &SafeBrowsingServiceImpl::UpdateSafeBrowsingEnabledState,
+ base::Unretained(this)));
UMA_HISTOGRAM_BOOLEAN(
safe_browsing::kSafeBrowsingEnabledHistogramName,
pref_change_registrar_->prefs()->GetBoolean(prefs::kSafeBrowsingEnabled));
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper_unittest.mm b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper_unittest.mm
index c6ad591..b810089 100644
--- a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper_unittest.mm
+++ b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper_unittest.mm
@@ -93,7 +93,7 @@
__block web::WebStatePolicyDecider::PolicyDecision policy_decision =
web::WebStatePolicyDecider::PolicyDecision::Allow();
auto callback =
- base::Bind(^(web::WebStatePolicyDecider::PolicyDecision decision) {
+ base::BindOnce(^(web::WebStatePolicyDecider::PolicyDecision decision) {
policy_decision = decision;
callback_called = true;
});
diff --git a/ios/chrome/browser/search_engines/template_url_service_factory.cc b/ios/chrome/browser/search_engines/template_url_service_factory.cc
index a13628892..40eb763 100644
--- a/ios/chrome/browser/search_engines/template_url_service_factory.cc
+++ b/ios/chrome/browser/search_engines/template_url_service_factory.cc
@@ -27,11 +27,11 @@
namespace ios {
namespace {
-base::Closure GetDefaultSearchProviderChangedCallback() {
+base::RepeatingClosure GetDefaultSearchProviderChangedCallback() {
#if BUILDFLAG(ENABLE_RLZ)
- return base::Bind(base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent),
- rlz_lib::CHROME, rlz::RLZTracker::ChromeOmnibox(),
- rlz_lib::SET_TO_GOOGLE);
+ return base::BindRepeating(
+ base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent), rlz_lib::CHROME,
+ rlz::RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE);
#else
return base::Closure();
#endif
diff --git a/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm b/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm
index b195a5c..a421ce9 100644
--- a/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm
+++ b/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm
@@ -80,7 +80,7 @@
if (!web_state) {
return nullptr;
}
- return FindLiveTabContextWithCondition(base::Bind(
+ return FindLiveTabContextWithCondition(base::BindRepeating(
[](const web::WebState* web_state, Browser* browser) {
WebStateList* web_state_list = browser->GetWebStateList();
const int index = web_state_list->GetIndexOfWebState(web_state);
@@ -92,7 +92,7 @@
sessions::LiveTabContext*
IOSChromeTabRestoreServiceClient::FindLiveTabContextWithID(
SessionID desired_id) {
- return FindLiveTabContextWithCondition(base::Bind(
+ return FindLiveTabContextWithCondition(base::BindRepeating(
[](SessionID desired_id, Browser* browser) {
SyncedWindowDelegateBrowserAgent* syncedWindowDelegate =
SyncedWindowDelegateBrowserAgent::FromBrowser(browser);
diff --git a/ios/chrome/browser/sync/glue/sync_start_util.cc b/ios/chrome/browser/sync/glue/sync_start_util.cc
index 7a4006ee..6e00c930 100644
--- a/ios/chrome/browser/sync/glue/sync_start_util.cc
+++ b/ios/chrome/browser/sync/glue/sync_start_util.cc
@@ -58,7 +58,7 @@
syncer::SyncableService::StartSyncFlare GetFlareForSyncableService(
const base::FilePath& browser_state_path) {
- return base::Bind(&StartSyncProxy, browser_state_path);
+ return base::BindRepeating(&StartSyncProxy, browser_state_path);
}
} // namespace sync_start_util
diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.h b/ios/chrome/browser/sync/ios_chrome_sync_client.h
index 104ab4c..f3121d4 100644
--- a/ios/chrome/browser/sync/ios_chrome_sync_client.h
+++ b/ios/chrome/browser/sync/ios_chrome_sync_client.h
@@ -45,7 +45,7 @@
history::HistoryService* GetHistoryService() override;
sync_preferences::PrefServiceSyncable* GetPrefServiceSyncable() override;
sync_sessions::SessionSyncService* GetSessionSyncService() override;
- base::Closure GetPasswordStateChangedCallback() override;
+ base::RepeatingClosure GetPasswordStateChangedCallback() override;
syncer::DataTypeController::TypeVector CreateDataTypeControllers(
syncer::SyncService* sync_service) override;
invalidation::InvalidationService* GetInvalidationService() override;
diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.mm b/ios/chrome/browser/sync/ios_chrome_sync_client.mm
index 9ea5ced..16653de 100644
--- a/ios/chrome/browser/sync/ios_chrome_sync_client.mm
+++ b/ios/chrome/browser/sync/ios_chrome_sync_client.mm
@@ -173,8 +173,8 @@
return SessionSyncServiceFactory::GetForBrowserState(browser_state_);
}
-base::Closure IOSChromeSyncClient::GetPasswordStateChangedCallback() {
- return base::Bind(
+base::RepeatingClosure IOSChromeSyncClient::GetPasswordStateChangedCallback() {
+ return base::BindRepeating(
&IOSChromePasswordStoreFactory::OnPasswordsSyncedStatePotentiallyChanged,
base::Unretained(browser_state_));
}
diff --git a/ios/chrome/browser/sync/profile_sync_service_factory.cc b/ios/chrome/browser/sync/profile_sync_service_factory.cc
index 176f390..728b4564 100644
--- a/ios/chrome/browser/sync/profile_sync_service_factory.cc
+++ b/ios/chrome/browser/sync/profile_sync_service_factory.cc
@@ -161,7 +161,8 @@
init_params.start_behavior = syncer::ProfileSyncService::MANUAL_START;
init_params.sync_client =
std::make_unique<IOSChromeSyncClient>(browser_state);
- init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime);
+ init_params.network_time_update_callback =
+ base::BindRepeating(&UpdateNetworkTime);
init_params.url_loader_factory = browser_state->GetSharedURLLoaderFactory();
init_params.network_connection_tracker =
GetApplicationContext()->GetNetworkConnectionTracker();
diff --git a/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.mm b/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.mm
index 6cfecf17..42c621d 100644
--- a/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.mm
+++ b/ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.mm
@@ -44,8 +44,8 @@
flare_(flare) {
tab_parented_subscription_ =
TabParentingGlobalObserver::GetInstance()->RegisterCallback(
- base::Bind(&IOSChromeLocalSessionEventRouter::OnTabParented,
- base::Unretained(this)));
+ base::BindRepeating(&IOSChromeLocalSessionEventRouter::OnTabParented,
+ base::Unretained(this)));
registrars_.insert(std::make_unique<AllWebStateListObservationRegistrar>(
browser_state, std::make_unique<Observer>(this),
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm
index 7301b38..8a84c0d2 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -57,10 +57,10 @@
DCHECK_CURRENTLY_ON(web::WebThread::UI);
task_tracker->PostTaskAndReply(
task_runner.get(), FROM_HERE,
- base::Bind(&web::CertificatePolicyCache::ClearCertificatePolicies,
- policy_cache),
- base::Bind(&RestoreCertificatePolicyCacheFromModel, policy_cache,
- base::Unretained(web_state_list)));
+ base::BindOnce(&web::CertificatePolicyCache::ClearCertificatePolicies,
+ policy_cache),
+ base::BindOnce(&RestoreCertificatePolicyCacheFromModel, policy_cache,
+ base::Unretained(web_state_list)));
}
} // anonymous namespace
diff --git a/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm b/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
index 84fff48..6307095 100644
--- a/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
+++ b/ios/chrome/browser/translate/js_language_detection_manager_unittest.mm
@@ -261,7 +261,7 @@
public:
void SetUp() override {
JsLanguageDetectionManagerTest::SetUp();
- auto callback = base::Bind(
+ auto callback = base::BindRepeating(
&JsLanguageDetectionManagerDetectLanguageTest::CommandReceived,
base::Unretained(this));
subscription_ =
diff --git a/ios/chrome/browser/ui/authentication/authentication_flow_performer.mm b/ios/chrome/browser/ui/authentication/authentication_flow_performer.mm
index 5e98f89f..902f7ee 100644
--- a/ios/chrome/browser/ui/authentication/authentication_flow_performer.mm
+++ b/ios/chrome/browser/ui/authentication/authentication_flow_performer.mm
@@ -123,7 +123,7 @@
_watchdogTimer->Start(
FROM_HERE,
base::TimeDelta::FromSeconds(kAuthenticationFlowTimeoutSeconds),
- base::Bind(onTimeout));
+ base::BindOnce(onTimeout));
}
- (BOOL)stopWatchdogTimer {
diff --git a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
index 3f5de18..43be96b1 100644
--- a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
+++ b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
@@ -224,9 +224,9 @@
UnmaskCardReason reason,
base::WeakPtr<CardUnmaskDelegate> delegate) {
unmask_controller_.ShowPrompt(
- base::Bind(&CreateCardUnmaskPromptViewBridge,
- base::Unretained(&unmask_controller_),
- base::Unretained(base_view_controller_)),
+ base::BindOnce(&CreateCardUnmaskPromptViewBridge,
+ base::Unretained(&unmask_controller_),
+ base::Unretained(base_view_controller_)),
card, reason, delegate);
}
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester.mm b/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester.mm
index 9abec8a..9a38f1b 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/full_card_requester.mm
@@ -45,9 +45,9 @@
autofill::AutofillClient::UnmaskCardReason reason,
base::WeakPtr<autofill::CardUnmaskDelegate> delegate) {
unmask_controller_.ShowPrompt(
- base::Bind(&CreateCardUnmaskPromptViewBridge,
- base::Unretained(&unmask_controller_),
- base::Unretained(base_view_controller_)),
+ base::BindOnce(&CreateCardUnmaskPromptViewBridge,
+ base::Unretained(&unmask_controller_),
+ base::Unretained(base_view_controller_)),
card, reason, delegate);
}
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
index 6bbf65e7..d0637994 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
@@ -141,7 +141,8 @@
EARL_GREY_TEST_DISABLED(@"Legacy Feed Test.");
}
// Set server up.
- self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
@@ -206,7 +207,8 @@
EARL_GREY_TEST_DISABLED(@"Legacy Feed Test.");
}
// Set server up.
- self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
@@ -416,7 +418,8 @@
// Setup a most visited tile, and open the context menu by long pressing on it.
- (void)setupMostVisitedTileLongPress {
- self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
NSString* pageTitle = base::SysUTF8ToNSString(kPageTitle);
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
index 33624ab..eba50ad 100644
--- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -446,7 +446,8 @@
EARL_GREY_TEST_DISABLED(@"Test disabled on iPad.");
}
// Setup the server.
- self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
@@ -625,7 +626,8 @@
#pragma mark - Helpers
- (void)addMostVisitedTile {
- self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&StandardResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
diff --git a/ios/chrome/browser/ui/download/download_manager_mediator.mm b/ios/chrome/browser/ui/download/download_manager_mediator.mm
index ed87ffca..fa1fc37 100644
--- a/ios/chrome/browser/ui/download/download_manager_mediator.mm
+++ b/ios/chrome/browser/ui/download/download_manager_mediator.mm
@@ -130,9 +130,10 @@
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
- base::Bind(base::PathExists, download_path_),
- base::Bind(&DownloadManagerMediator::MoveToUserDocumentsIfFileExists,
- weak_ptr_factory_.GetWeakPtr(), download_path_));
+ base::BindOnce(base::PathExists, download_path_),
+ base::BindOnce(
+ &DownloadManagerMediator::MoveToUserDocumentsIfFileExists,
+ weak_ptr_factory_.GetWeakPtr(), download_path_));
}
}
@@ -167,9 +168,9 @@
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
- base::Bind(&base::Move, download_path_, user_download_path),
- base::Bind(&DownloadManagerMediator::RestoreDownloadPath,
- weak_ptr_factory_.GetWeakPtr(), user_download_path));
+ base::BindOnce(&base::Move, download_path_, user_download_path),
+ base::BindOnce(&DownloadManagerMediator::RestoreDownloadPath,
+ weak_ptr_factory_.GetWeakPtr(), user_download_path));
}
void DownloadManagerMediator::RestoreDownloadPath(
diff --git a/ios/chrome/browser/ui/download/pass_kit_egtest.mm b/ios/chrome/browser/ui/download/pass_kit_egtest.mm
index 05fd3a09..6f2c8c4 100644
--- a/ios/chrome/browser/ui/download/pass_kit_egtest.mm
+++ b/ios/chrome/browser/ui/download/pass_kit_egtest.mm
@@ -74,7 +74,7 @@
- (void)setUp {
[super setUp];
- self.testServer->RegisterRequestHandler(base::Bind(&GetResponse));
+ self.testServer->RegisterRequestHandler(base::BindRepeating(&GetResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
}
diff --git a/ios/chrome/browser/ui/list_model/list_model_unittest.mm b/ios/chrome/browser/ui/list_model/list_model_unittest.mm
index 9522a39..d63eba6 100644
--- a/ios/chrome/browser/ui/list_model/list_model_unittest.mm
+++ b/ios/chrome/browser/ui/list_model/list_model_unittest.mm
@@ -318,7 +318,8 @@
ListModel* model = [[ListModel alloc] init];
[model addSectionWithIdentifier:SectionIdentifierCheese];
- logging::ScopedLogAssertHandler scoped_assert_handler(base::Bind(LogSink));
+ logging::ScopedLogAssertHandler scoped_assert_handler(
+ base::BindRepeating(LogSink));
bool out_of_bounds_exception_thrown = false;
@try {
[model indexInItemTypeForIndexPath:[NSIndexPath indexPathForItem:0
diff --git a/ios/chrome/browser/ui/ntp/notification_promo_whats_new_unittest.mm b/ios/chrome/browser/ui/ntp/notification_promo_whats_new_unittest.mm
index c507db52..379f977 100644
--- a/ios/chrome/browser/ui/ntp/notification_promo_whats_new_unittest.mm
+++ b/ios/chrome/browser/ui/ntp/notification_promo_whats_new_unittest.mm
@@ -34,8 +34,8 @@
NotificationPromoWhatsNewTest()
: promo_(&local_state_),
action_callback_(
- base::Bind(&NotificationPromoWhatsNewTest::OnUserAction,
- base::Unretained(this))) {
+ base::BindRepeating(&NotificationPromoWhatsNewTest::OnUserAction,
+ base::Unretained(this))) {
ios::NotificationPromo::RegisterPrefs(local_state_.registry());
local_state_.registry()->RegisterInt64Pref(metrics::prefs::kInstallDate, 0);
base::AddActionCallback(action_callback_);
diff --git a/ios/chrome/browser/ui/settings/search_engine_settings_egtest.mm b/ios/chrome/browser/ui/settings/search_engine_settings_egtest.mm
index 8ff5762a..1905066 100644
--- a/ios/chrome/browser/ui/settings/search_engine_settings_egtest.mm
+++ b/ios/chrome/browser/ui/settings/search_engine_settings_egtest.mm
@@ -114,7 +114,7 @@
// Tests that when changing the default search engine, the URL used for the
// search is updated.
- (void)testChangeSearchEngine {
- self.testServer->RegisterRequestHandler(base::Bind(&SearchResponse));
+ self.testServer->RegisterRequestHandler(base::BindRepeating(&SearchResponse));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
GURL url = self.testServer->GetURL(kPageURL);
@@ -239,8 +239,8 @@
// enters the search engine screen in Settings.
- (void)enterSettingsWithCustomSearchEngine {
_openSearchCalled = false;
- self.testServer->RegisterRequestHandler(
- base::Bind(&StandardResponse, &(_serverURL), &(_openSearchCalled)));
+ self.testServer->RegisterRequestHandler(base::BindRepeating(
+ &StandardResponse, &(_serverURL), &(_openSearchCalled)));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL pageURL = self.testServer->GetURL(kPageURL);
_serverURL = pageURL.spec();
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_transition_egtest.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_transition_egtest.mm
index 4fca0d7..be655b6 100644
--- a/ios/chrome/browser/ui/tab_grid/tab_grid_transition_egtest.mm
+++ b/ios/chrome/browser/ui/tab_grid/tab_grid_transition_egtest.mm
@@ -79,9 +79,9 @@
// Sets up the EmbeddedTestServer as needed for tests.
- (void)setUpTestServer {
- self.testServer->RegisterDefaultHandler(
- base::Bind(net::test_server::HandlePrefixedRequest, "/querytitle",
- base::Bind(&HandleQueryTitle)));
+ self.testServer->RegisterDefaultHandler(base::BindRepeating(
+ net::test_server::HandlePrefixedRequest, "/querytitle",
+ base::BindRepeating(&HandleQueryTitle)));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start");
}
diff --git a/ios/chrome/browser/ui/webui/crashes_ui.cc b/ios/chrome/browser/ui/webui/crashes_ui.cc
index b3bde32..6c4a5b8 100644
--- a/ios/chrome/browser/ui/webui/crashes_ui.cc
+++ b/ios/chrome/browser/ui/webui/crashes_ui.cc
@@ -109,8 +109,8 @@
UpdateUI();
} else {
list_available_ = false;
- upload_list_->Load(base::Bind(&CrashesDOMHandler::OnUploadListAvailable,
- base::Unretained(this)));
+ upload_list_->Load(base::BindOnce(&CrashesDOMHandler::OnUploadListAvailable,
+ base::Unretained(this)));
}
}
diff --git a/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc
index 95b5d60..daa7ea0 100644
--- a/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc
+++ b/ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.cc
@@ -98,8 +98,9 @@
ReturnResults(browser_state->GetPrefs(), nullptr, nullptr);
} else {
profile_service->driver()->GetGCMStatistics(
- base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
- weak_ptr_factory_.GetWeakPtr()),
+ base::BindOnce(
+ &GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
+ weak_ptr_factory_.GetWeakPtr()),
clear_activity_logs);
}
}
@@ -126,8 +127,9 @@
}
// Get fresh stats after changing recording setting.
profile_service->driver()->SetGCMRecording(
- base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
- weak_ptr_factory_.GetWeakPtr()),
+ base::BindRepeating(
+ &GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
+ weak_ptr_factory_.GetWeakPtr()),
recording);
}
diff --git a/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm b/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm
index ba0114d..013a63a 100644
--- a/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm
+++ b/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm
@@ -165,8 +165,8 @@
void NetExportMessageHandler::OnSendNetLog(const base::ListValue* list) {
DCHECK_CURRENTLY_ON(web::WebThread::UI);
- file_writer_->GetFilePathToCompletedLog(
- base::Bind(&NetExportMessageHandler::SendEmail, base::Unretained(this)));
+ file_writer_->GetFilePathToCompletedLog(base::BindOnce(
+ &NetExportMessageHandler::SendEmail, base::Unretained(this)));
}
void NetExportMessageHandler::OnNewState(const base::DictionaryValue& state) {
diff --git a/ios/chrome/browser/ui/webui/omaha_ui.cc b/ios/chrome/browser/ui/webui/omaha_ui.cc
index 7a9b83b..ccf43c6 100644
--- a/ios/chrome/browser/ui/webui/omaha_ui.cc
+++ b/ios/chrome/browser/ui/webui/omaha_ui.cc
@@ -70,8 +70,8 @@
void OmahaDOMHandler::HandleRequestDebugInformation(
const base::ListValue* args) {
OmahaService::GetDebugInformation(
- base::Bind(&OmahaDOMHandler::OnDebugInformationAvailable,
- weak_ptr_factory_.GetWeakPtr()));
+ base::BindOnce(&OmahaDOMHandler::OnDebugInformationAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
}
void OmahaDOMHandler::OnDebugInformationAvailable(
diff --git a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm
index 4a4d607..52ef977 100644
--- a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm
+++ b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm
@@ -136,7 +136,7 @@
}
void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) {
- GetPolicyService()->RefreshPolicies(base::Bind(
+ GetPolicyService()->RefreshPolicies(base::BindOnce(
&PolicyUIHandler::OnRefreshPoliciesDone, weak_factory_.GetWeakPtr()));
}
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
index c8edc94..091f43c 100644
--- a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
+++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
@@ -53,7 +53,7 @@
TEST_F(IOSChromeUpdateQueryParamsDelegateTest, GetParams) {
base::ScopedClosureRunner runner(
- base::Bind(update_client::UpdateQueryParams::SetDelegate, nullptr));
+ base::BindOnce(update_client::UpdateQueryParams::SetDelegate, nullptr));
update_client::UpdateQueryParams::SetDelegate(
IOSChromeUpdateQueryParamsDelegate::GetInstance());
diff --git a/ios/chrome/browser/web/navigation_egtest.mm b/ios/chrome/browser/web/navigation_egtest.mm
index e15c5e9..d9bbb064 100644
--- a/ios/chrome/browser/web/navigation_egtest.mm
+++ b/ios/chrome/browser/web/navigation_egtest.mm
@@ -340,7 +340,7 @@
// and verifies the URLs and that hashchange event is fired.
- (void)testWindowLocationChangeHash {
self.testServer->RegisterRequestHandler(
- base::Bind(&WindowLocationHashHandlers));
+ base::BindRepeating(&WindowLocationHashHandlers));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL page1URL = self.testServer->GetURL(kPage1URL);
const GURL hashChangedWithHistoryURL =
@@ -384,7 +384,7 @@
// and verifies that going back returns to the replaced entry.
- (void)testWindowLocationReplaceAndChangeHash {
self.testServer->RegisterRequestHandler(
- base::Bind(&WindowLocationHashHandlers));
+ base::BindRepeating(&WindowLocationHashHandlers));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL page1URL = self.testServer->GetURL(kPage1URL);
const GURL hashChangedWithHistoryURL =
@@ -422,7 +422,7 @@
// only one entry in the history by navigating back.
- (void)testWindowLocationChangeToSameHash {
self.testServer->RegisterRequestHandler(
- base::Bind(&WindowLocationHashHandlers));
+ base::BindRepeating(&WindowLocationHashHandlers));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL page1URL = self.testServer->GetURL(kPage1URL);
const GURL hashChangedWithHistoryURL =
@@ -461,7 +461,8 @@
// Navigates to a page that immediately redirects to another page via JavaScript
// then verifies the browsing history.
- (void)testJavaScriptRedirect {
- self.testServer->RegisterRequestHandler(base::Bind(&RedirectHandlers));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&RedirectHandlers));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
// A starting page.
const GURL initialURL = self.testServer->GetURL(kDefaultPageURL);
@@ -519,7 +520,8 @@
}
- (void)verifyBackAndForwardAfterRedirect:(std::string)redirectLabel {
- self.testServer->RegisterRequestHandler(base::Bind(&RedirectHandlers));
+ self.testServer->RegisterRequestHandler(
+ base::BindRepeating(&RedirectHandlers));
GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
const GURL indexURL(self.testServer->GetURL(kRedirectIndexURL));
const GURL destinationURL(self.testServer->GetURL(kDestinationURL));
diff --git a/ios/chrome/browser/web/print_tab_helper.mm b/ios/chrome/browser/web/print_tab_helper.mm
index 4156be8..3277870 100644
--- a/ios/chrome/browser/web/print_tab_helper.mm
+++ b/ios/chrome/browser/web/print_tab_helper.mm
@@ -28,8 +28,8 @@
PrintTabHelper::PrintTabHelper(web::WebState* web_state) {
web_state->AddObserver(this);
subscription_ = web_state->AddScriptCommandCallback(
- base::Bind(&PrintTabHelper::OnPrintCommand, base::Unretained(this),
- base::Unretained(web_state)),
+ base::BindRepeating(&PrintTabHelper::OnPrintCommand,
+ base::Unretained(this), base::Unretained(web_state)),
kPrintCommandPrefix);
}
diff --git a/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm b/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm
index 30eac06..aa11677 100644
--- a/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm
+++ b/ios/chrome/browser/web/repost_form_tab_helper_unittest.mm
@@ -102,7 +102,7 @@
// Tests presentation location.
TEST_F(RepostFormTabHelperTest, Location) {
EXPECT_FALSE(CGPointEqualToPoint(delegate_.location, location_));
- tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool));
+ tab_helper()->PresentDialog(location_, base::BindOnce(&IgnoreBool));
EXPECT_TRUE(CGPointEqualToPoint(delegate_.location, location_));
}
@@ -139,7 +139,7 @@
// Tests that dialog is dismissed when WebState is destroyed.
TEST_F(RepostFormTabHelperTest, DismissingOnWebStateDestruction) {
ASSERT_FALSE(delegate_.presentingDialog);
- tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool));
+ tab_helper()->PresentDialog(location_, base::BindOnce(&IgnoreBool));
EXPECT_TRUE(delegate_.presentingDialog);
web_state_.reset();
EXPECT_FALSE(delegate_.presentingDialog);
@@ -148,7 +148,7 @@
// Tests that dialog is dismissed after provisional navigation has started.
TEST_F(RepostFormTabHelperTest, DismissingOnNavigationStart) {
ASSERT_FALSE(delegate_.presentingDialog);
- tab_helper()->PresentDialog(location_, base::Bind(&IgnoreBool));
+ tab_helper()->PresentDialog(location_, base::BindOnce(&IgnoreBool));
EXPECT_TRUE(delegate_.presentingDialog);
web_state_->OnNavigationStarted(nullptr /* navigation_context */);
EXPECT_FALSE(delegate_.presentingDialog);
diff --git a/ios/chrome/test/run_all_unittests.cc b/ios/chrome/test/run_all_unittests.cc
index e9d37063..d8568e4e 100644
--- a/ios/chrome/test/run_all_unittests.cc
+++ b/ios/chrome/test/run_all_unittests.cc
@@ -24,7 +24,7 @@
ipc_thread.task_runner(),
mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
- return base::LaunchUnitTests(
- argc, argv,
- base::Bind(&IOSChromeUnitTestSuite::Run, base::Unretained(&test_suite)));
+ return base::LaunchUnitTests(argc, argv,
+ base::BindOnce(&IOSChromeUnitTestSuite::Run,
+ base::Unretained(&test_suite)));
}
diff --git a/ios/chrome/test/testing_application_context.mm b/ios/chrome/test/testing_application_context.mm
index bcdef3c3..a43cd677a 100644
--- a/ios/chrome/test/testing_application_context.mm
+++ b/ios/chrome/test/testing_application_context.mm
@@ -213,7 +213,7 @@
if (!browser_policy_connector_.get()) {
browser_policy_connector_ = std::make_unique<BrowserPolicyConnectorIOS>(
- base::Bind(&BuildPolicyHandlerList, true));
+ base::BindRepeating(&BuildPolicyHandlerList, true));
}
return browser_policy_connector_.get();