Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1452)

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 8840003: Replace ProfileManagerObserver with callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/login_performer.cc ('k') | chrome/browser/profiles/avatar_menu_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 55635697b67e215a36ab4b8b4faa6bb86b177092..46e0fa9e9a32cc1cd5142a60acb1132e1a38010e 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -521,10 +521,10 @@ class JobRestartRequest
};
class LoginUtilsImpl : public LoginUtils,
- public ProfileManagerObserver,
public GaiaOAuthConsumer,
public OAuthLoginVerifier::Delegate,
- public net::NetworkChangeNotifier::OnlineStateObserver {
+ public net::NetworkChangeNotifier::OnlineStateObserver,
+ public base::SupportsWeakPtr<LoginUtilsImpl> {
public:
LoginUtilsImpl()
: background_view_(NULL),
@@ -569,9 +569,6 @@ class LoginUtilsImpl : public LoginUtils,
virtual void TransferDefaultAuthCache(Profile* default_profile,
Profile* new_profile) OVERRIDE;
- // ProfileManagerObserver implementation:
- virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE;
-
// GaiaOAuthConsumer overrides.
virtual void OnGetOAuthTokenSuccess(const std::string& oauth_token) OVERRIDE;
virtual void OnGetOAuthTokenFailure(
@@ -639,6 +636,10 @@ class LoginUtilsImpl : public LoginUtils,
// Check user's profile for kApplicationLocale setting.
void RespectLocalePreference(Profile* pref);
+ // Callback for asynchronous profile creation.
+ void OnProfileCreated(Profile* profile,
+ Profile::CreateStatus status);
+
// The current background view.
chromeos::BackgroundView* background_view_;
@@ -758,7 +759,8 @@ void LoginUtilsImpl::PrepareProfile(
// The default profile will have been changed because the ProfileManager
// will process the notification that the UserManager sends out.
- ProfileManager::CreateDefaultProfileAsync(this);
+ ProfileManager::CreateDefaultProfileAsync(
+ base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
}
void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) {
@@ -766,17 +768,19 @@ void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) {
delegate_ = NULL;
}
-void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) {
+void LoginUtilsImpl::OnProfileCreated(
+ Profile* user_profile,
+ Profile::CreateStatus status) {
CHECK(user_profile);
switch (status) {
- case STATUS_INITIALIZED:
+ case Profile::CREATE_STATUS_INITIALIZED:
break;
- case STATUS_CREATED:
+ case Profile::CREATE_STATUS_CREATED:
if (UserManager::Get()->current_user_is_new())
SetFirstLoginPrefs(user_profile->GetPrefs());
RespectLocalePreference(user_profile);
return;
- case STATUS_FAIL:
+ case Profile::CREATE_STATUS_FAIL:
default:
NOTREACHED();
return;
« no previous file with comments | « chrome/browser/chromeos/login/login_performer.cc ('k') | chrome/browser/profiles/avatar_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698