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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_handler.cc

Issue 22751002: Dynamically update sign-in/Sync status in the profile creation overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip for tests Created 7 years, 4 months 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/ui/webui/options/manage_profile_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/manage_profile_handler.cc
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index a7d01525c113891941a55690a761a83dc7d16313..0d54e682e536f3a216c12b55c4ace6b594915ef1 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -82,6 +82,11 @@ ManageProfileHandler::ManageProfileHandler()
}
ManageProfileHandler::~ManageProfileHandler() {
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
+ // Sync may be disabled in tests.
+ if (service)
+ service->RemoveObserver(this);
}
void ManageProfileHandler::GetLocalizedValues(
@@ -140,11 +145,17 @@ void ManageProfileHandler::InitializeHandler() {
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
content::NotificationService::AllSources());
- pref_change_registrar_.Init(Profile::FromWebUI(web_ui())->GetPrefs());
+ Profile* profile = Profile::FromWebUI(web_ui());
+ pref_change_registrar_.Init(profile->GetPrefs());
pref_change_registrar_.Add(
prefs::kManagedUserCreationAllowed,
base::Bind(&ManageProfileHandler::OnCreateManagedUserPrefChange,
base::Unretained(this)));
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetForProfile(profile);
+ // Sync may be disabled for tests.
+ if (service)
+ service->AddObserver(this);
}
void ManageProfileHandler::InitializePage() {
@@ -206,6 +217,10 @@ void ManageProfileHandler::Observe(
}
}
+void ManageProfileHandler::OnStateChanged() {
+ RequestCreateProfileUpdate(NULL);
+}
+
void ManageProfileHandler::RequestDefaultProfileIcons(const ListValue* args) {
base::StringValue create_value(kCreateProfileIconGridName);
base::StringValue manage_value(kManageProfileIconGridName);
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698