Commit bd19b41f authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Use OnceClosure in arc_util

BUG=NONE

Change-Id: I6130bcff05d90ad35b3106eeee6d8973c58b8c11
Reviewed-on: https://chromium-review.googlesource.com/1090311Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Toni Barzic <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565359}
parent 8f672b21
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <map> #include <map>
#include <set> #include <set>
#include <string> #include <string>
#include <utility>
#include "base/callback.h" #include "base/callback.h"
#include "base/command_line.h" #include "base/command_line.h"
...@@ -99,7 +100,7 @@ FileSystemCompatibilityState GetFileSystemCompatibilityPref( ...@@ -99,7 +100,7 @@ FileSystemCompatibilityState GetFileSystemCompatibilityPref(
// Stores the result of IsArcCompatibleFilesystem posted back from the blocking // Stores the result of IsArcCompatibleFilesystem posted back from the blocking
// task runner. // task runner.
void StoreCompatibilityCheckResult(const AccountId& account_id, void StoreCompatibilityCheckResult(const AccountId& account_id,
const base::Closure& callback, base::OnceClosure callback,
bool is_compatible) { bool is_compatible) {
if (is_compatible) { if (is_compatible) {
user_manager::known_user::SetIntegerPref( user_manager::known_user::SetIntegerPref(
...@@ -111,7 +112,7 @@ void StoreCompatibilityCheckResult(const AccountId& account_id, ...@@ -111,7 +112,7 @@ void StoreCompatibilityCheckResult(const AccountId& account_id,
if (GetFileSystemCompatibilityPref(account_id) != kFileSystemCompatible) if (GetFileSystemCompatibilityPref(account_id) != kFileSystemCompatible)
g_known_compatible_users.Get().insert(account_id); g_known_compatible_users.Get().insert(account_id);
} }
callback.Run(); std::move(callback).Run();
} }
bool IsArcMigrationAllowedInternal(const Profile* profile) { bool IsArcMigrationAllowedInternal(const Profile* profile) {
...@@ -548,8 +549,8 @@ bool IsArcStatsReportingEnabled() { ...@@ -548,8 +549,8 @@ bool IsArcStatsReportingEnabled() {
void UpdateArcFileSystemCompatibilityPrefIfNeeded( void UpdateArcFileSystemCompatibilityPrefIfNeeded(
const AccountId& account_id, const AccountId& account_id,
const base::FilePath& profile_path, const base::FilePath& profile_path,
const base::Closure& callback) { base::OnceClosure callback) {
DCHECK(!callback.is_null()); DCHECK(callback);
// If ARC is not available, skip the check. // If ARC is not available, skip the check.
// This shortcut is just for merginally improving the log-in performance on // This shortcut is just for merginally improving the log-in performance on
...@@ -557,13 +558,13 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded( ...@@ -557,13 +558,13 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded(
// without changing any functionality when, say, the code clarity becomes // without changing any functionality when, say, the code clarity becomes
// more important in the future. // more important in the future.
if (!IsArcAvailable() && !IsArcKioskAvailable()) { if (!IsArcAvailable() && !IsArcKioskAvailable()) {
callback.Run(); std::move(callback).Run();
return; return;
} }
// If the compatibility has been already confirmed, skip the check. // If the compatibility has been already confirmed, skip the check.
if (GetFileSystemCompatibilityPref(account_id) != kFileSystemIncompatible) { if (GetFileSystemCompatibilityPref(account_id) != kFileSystemIncompatible) {
callback.Run(); std::move(callback).Run();
return; return;
} }
...@@ -572,8 +573,9 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded( ...@@ -572,8 +573,9 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded(
FROM_HERE, FROM_HERE,
{base::MayBlock(), base::TaskPriority::USER_BLOCKING, {base::MayBlock(), base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
base::Bind(&IsArcCompatibleFilesystem, profile_path), base::BindOnce(&IsArcCompatibleFilesystem, profile_path),
base::Bind(&StoreCompatibilityCheckResult, account_id, callback)); base::BindOnce(&StoreCompatibilityCheckResult, account_id,
std::move(callback)));
} }
ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile( ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
......
...@@ -148,7 +148,7 @@ bool IsArcStatsReportingEnabled(); ...@@ -148,7 +148,7 @@ bool IsArcStatsReportingEnabled();
void UpdateArcFileSystemCompatibilityPrefIfNeeded( void UpdateArcFileSystemCompatibilityPrefIfNeeded(
const AccountId& account_id, const AccountId& account_id,
const base::FilePath& profile_path, const base::FilePath& profile_path,
const base::Closure& callback); base::OnceClosure callback);
// Returns whether Google Assistant feature is allowed for given |profile|. // Returns whether Google Assistant feature is allowed for given |profile|.
ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile( ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
......
...@@ -586,7 +586,7 @@ void UserSessionManager::StartSession(const UserContext& user_context, ...@@ -586,7 +586,7 @@ void UserSessionManager::StartSession(const UserContext& user_context,
arc::UpdateArcFileSystemCompatibilityPrefIfNeeded( arc::UpdateArcFileSystemCompatibilityPrefIfNeeded(
user_context_.GetAccountId(), user_context_.GetAccountId(),
ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash()), ProfileHelper::GetProfilePathByUserIdHash(user_context_.GetUserIDHash()),
base::Bind(&UserSessionManager::PrepareProfile, AsWeakPtr())); base::BindOnce(&UserSessionManager::PrepareProfile, AsWeakPtr()));
} }
void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) { void UserSessionManager::DelegateDeleted(UserSessionManagerDelegate* delegate) {
......
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