Commit 338c95c1 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Convert base::Closure in chrome/browser/google/

This is a code health CL, no behavior change is expected.

Bug: 1007635
Change-Id: I2e83ea768461f2041fd173bca193e6e510d5d886
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2277250
Auto-Submit: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785799}
parent df35a74d
...@@ -121,7 +121,7 @@ void UserSessionInitializer::InitRlz(Profile* profile) { ...@@ -121,7 +121,7 @@ void UserSessionInitializer::InitRlz(Profile* profile) {
->GetString() ->GetString()
.empty()) { .empty()) {
// Read brand code asynchronously from an OEM data and repost ourselves. // Read brand code asynchronously from an OEM data and repost ourselves.
google_brand::chromeos::InitBrand(base::Bind( google_brand::chromeos::InitBrand(base::BindOnce(
&UserSessionInitializer::InitRlz, weak_factory_.GetWeakPtr(), profile)); &UserSessionInitializer::InitRlz, weak_factory_.GetWeakPtr(), profile));
return; return;
} }
......
...@@ -43,11 +43,11 @@ std::string ReadBrandFromFile() { ...@@ -43,11 +43,11 @@ std::string ReadBrandFromFile() {
} }
// For a valid |brand|, sets the brand code and runs |callback|. // For a valid |brand|, sets the brand code and runs |callback|.
void SetBrand(const base::Closure& callback, const std::string& brand) { void SetBrand(base::OnceClosure callback, const std::string& brand) {
if (!IsBrandValid(brand)) if (!IsBrandValid(brand))
return; return;
g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand); g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand);
callback.Run(); std::move(callback).Run();
} }
// True if brand code has been cleared for the current session. // True if brand code has been cleared for the current session.
...@@ -86,14 +86,14 @@ std::string GetRlzBrand() { ...@@ -86,14 +86,14 @@ std::string GetRlzBrand() {
return GetRlzBrandCode(GetBrand(), market_segment); return GetRlzBrandCode(GetBrand(), market_segment);
} }
void InitBrand(const base::Closure& callback) { void InitBrand(base::OnceClosure callback) {
::chromeos::system::StatisticsProvider* provider = ::chromeos::system::StatisticsProvider* provider =
::chromeos::system::StatisticsProvider::GetInstance(); ::chromeos::system::StatisticsProvider::GetInstance();
std::string brand; std::string brand;
const bool found = provider->GetMachineStatistic( const bool found = provider->GetMachineStatistic(
::chromeos::system::kRlzBrandCodeKey, &brand); ::chromeos::system::kRlzBrandCodeKey, &brand);
if (found && IsBrandValid(brand)) { if (found && IsBrandValid(brand)) {
SetBrand(callback, brand); SetBrand(std::move(callback), brand);
return; return;
} }
...@@ -101,7 +101,8 @@ void InitBrand(const base::Closure& callback) { ...@@ -101,7 +101,8 @@ void InitBrand(const base::Closure& callback) {
FROM_HERE, FROM_HERE,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT, {base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
base::BindOnce(&ReadBrandFromFile), base::BindOnce(&SetBrand, callback)); base::BindOnce(&ReadBrandFromFile),
base::BindOnce(&SetBrand, std::move(callback)));
} }
} // namespace chromeos } // namespace chromeos
......
...@@ -27,7 +27,7 @@ void ClearBrandForCurrentSession(); ...@@ -27,7 +27,7 @@ void ClearBrandForCurrentSession();
// Reads the brand code from a board-specific data file and stores it to // Reads the brand code from a board-specific data file and stores it to
// Local State. |callback| is invoked on the calling thread upon success, and // Local State. |callback| is invoked on the calling thread upon success, and
// is not invoked if the brand code is not found or is empty. // is not invoked if the brand code is not found or is empty.
void InitBrand(const base::Closure& callback); void InitBrand(base::OnceClosure callback);
} // namespace chromeos } // namespace chromeos
} // namespace google_brand } // namespace google_brand
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment