| Index: chrome/browser/chromeos/login/user_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
|
| index 2d8d85bd65dc7498ce1870d9cbb2b7d5c7996347..4e7a6f629ad48f1220d9eeedbc17ea044f574dfd 100644
|
| --- a/chrome/browser/chromeos/login/user_manager.cc
|
| +++ b/chrome/browser/chromeos/login/user_manager.cc
|
| @@ -4,12 +4,14 @@
|
|
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
|
|
| +#include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/file_path.h"
|
| #include "base/file_util.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/path_service.h"
|
| #include "base/rand_util.h"
|
| @@ -20,6 +22,7 @@
|
| #include "base/values.h"
|
| #include "crypto/nss_util.h"
|
| #include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/chromeos/cros_settings.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| #include "chrome/browser/chromeos/cros/cryptohome_library.h"
|
| #include "chrome/browser/chromeos/input_method/input_method_manager.h"
|
| @@ -132,8 +135,8 @@ void SaveImageToFile(const SkBitmap& image,
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - NewRunnableFunction(&SavePathToLocalState,
|
| - username, image_path.value()));
|
| + base::Bind(&SavePathToLocalState,
|
| + username, image_path.value()));
|
| }
|
|
|
| // Deletes user's image file. Runs on FILE thread.
|
| @@ -173,7 +176,7 @@ void CheckOwnership() {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - NewRunnableFunction(&UpdateOwnership, is_owner));
|
| + base::Bind(&UpdateOwnership, is_owner));
|
| }
|
|
|
| // Used to handle the asynchronous response of deleting a cryptohome directory.
|
| @@ -185,7 +188,7 @@ class RemoveAttempt : public CryptohomeLibrary::Delegate {
|
| chromeos::RemoveUserDelegate* delegate)
|
| : user_email_(user_email),
|
| delegate_(delegate),
|
| - method_factory_(this) {
|
| + pointer_factory_(this) {
|
| RemoveUser();
|
| }
|
|
|
| @@ -194,15 +197,18 @@ class RemoveAttempt : public CryptohomeLibrary::Delegate {
|
| void RemoveUser() {
|
| // Owner is not allowed to be removed from the device.
|
| // Must not proceed without signature verification.
|
| - UserCrosSettingsProvider user_settings;
|
| - bool trusted_owner_available = user_settings.RequestTrustedOwner(
|
| - method_factory_.NewRunnableMethod(&RemoveAttempt::RemoveUser));
|
| + CrosSettings* cros_settings = CrosSettings::Get();
|
| + bool trusted_owner_available = cros_settings->GetTrusted(
|
| + kDeviceOwner,
|
| + base::Bind(&RemoveAttempt::RemoveUser, pointer_factory_.GetWeakPtr()));
|
| if (!trusted_owner_available) {
|
| // Value of owner email is still not verified.
|
| // Another attempt will be invoked after verification completion.
|
| return;
|
| }
|
| - if (user_email_ == UserCrosSettingsProvider::cached_owner()) {
|
| + std::string owner;
|
| + cros_settings->GetString(kDeviceOwner, &owner);
|
| + if (user_email_ == owner) {
|
| // Owner is not allowed to be removed from the device. Probably on
|
| // the stack, so deffer the deletion.
|
| MessageLoop::current()->DeleteSoon(FROM_HERE, this);
|
| @@ -240,7 +246,7 @@ class RemoveAttempt : public CryptohomeLibrary::Delegate {
|
| chromeos::RemoveUserDelegate* delegate_;
|
|
|
| // Factory of callbacks.
|
| - ScopedRunnableMethodFactory<RemoveAttempt> method_factory_;
|
| + base::WeakPtrFactory<RemoveAttempt> pointer_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(RemoveAttempt);
|
| };
|
| @@ -483,8 +489,7 @@ void UserManager::RemoveUserFromList(const std::string& email) {
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE,
|
| FROM_HERE,
|
| - NewRunnableFunction(&DeleteUserImage,
|
| - image_path));
|
| + base::Bind(&DeleteUserImage, image_path));
|
| }
|
| }
|
|
|
| @@ -537,8 +542,8 @@ void UserManager::SaveUserImage(const std::string& username,
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE,
|
| FROM_HERE,
|
| - NewRunnableFunction(&SaveImageToFile,
|
| - image, image_path, username));
|
| + base::Bind(&SaveImageToFile,
|
| + image, image_path, username));
|
| }
|
|
|
| void UserManager::SaveUserOAuthStatus(const std::string& username,
|
| @@ -685,7 +690,7 @@ void UserManager::NotifyOnLogin() {
|
|
|
| // Schedules current user ownership check on file thread.
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| - NewRunnableFunction(&CheckOwnership));
|
| + base::Bind(&CheckOwnership));
|
| }
|
|
|
| void UserManager::Observe(int type,
|
| @@ -693,7 +698,7 @@ void UserManager::Observe(int type,
|
| const NotificationDetails& details) {
|
| if (type == chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) {
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| - NewRunnableFunction(&CheckOwnership));
|
| + base::Bind(&CheckOwnership));
|
| }
|
| }
|
|
|
|
|