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

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

Issue 895803003: [Profiles] Remove the NotificationService from the ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cait nit Created 5 years, 10 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
Index: chrome/browser/ui/webui/options/browser_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 7e7f52929ed96a3530149d794dcb84649be32082..531cb75cb9300323402ba2c0e31acf679603aeb2 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -801,6 +801,8 @@ void BrowserOptionsHandler::RegisterMessages() {
void BrowserOptionsHandler::Uninitialize() {
registrar_.RemoveAll();
+ g_browser_process->profile_manager()->
+ GetProfileInfoCache().RemoveObserver(this);
#if defined(OS_WIN)
ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this);
#endif
@@ -851,6 +853,8 @@ void BrowserOptionsHandler::InitializeHandler() {
g_browser_process->policy_service()->AddObserver(
policy::POLICY_DOMAIN_CHROME, this);
+ g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
+
ProfileSyncService* sync_service(
ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile));
// TODO(blundell): Use a ScopedObserver to observe the PSS so that cleanup on
@@ -873,8 +877,6 @@ void BrowserOptionsHandler::InitializeHandler() {
base::Bind(&BrowserOptionsHandler::UpdateDefaultBrowserState,
base::Unretained(this)));
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
- content::NotificationService::AllSources());
#if defined(OS_CHROMEOS)
registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
content::NotificationService::AllSources());
@@ -1270,9 +1272,6 @@ void BrowserOptionsHandler::Observe(
UpdateAccountPicture();
break;
#endif
- case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED:
- SendProfilesInfo();
- break;
case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
// Update our sync/signin status display.
OnStateChanged();
@@ -1282,6 +1281,27 @@ void BrowserOptionsHandler::Observe(
}
}
+void BrowserOptionsHandler::OnProfileAdded(const base::FilePath& profile_path) {
+ SendProfilesInfo();
+}
+
+void BrowserOptionsHandler::OnProfileWasRemoved(
+ const base::FilePath& profile_path,
+ const base::string16& profile_name) {
+ SendProfilesInfo();
+}
+
+void BrowserOptionsHandler::OnProfileNameChanged(
+ const base::FilePath& profile_path,
+ const base::string16& old_profile_name) {
+ SendProfilesInfo();
+}
+
+void BrowserOptionsHandler::OnProfileAvatarChanged(
+ const base::FilePath& profile_path) {
+ SendProfilesInfo();
+}
+
void BrowserOptionsHandler::ToggleAutoLaunch(const base::ListValue* args) {
#if defined(OS_WIN)
if (!auto_launch_trial::IsInAutoLaunchGroup())

Powered by Google App Engine
This is Rietveld 408576698