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

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: s/public/protected/ 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 3374ad0c058a2a25195f7f091ebfc42824db0c89..f75fe51612fc9b79be2d796545f70d85d20700cc 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -807,6 +807,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
@@ -857,6 +859,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
@@ -879,8 +883,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());
@@ -1276,9 +1278,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();
@@ -1288,6 +1287,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