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

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

Issue 895803003: [Profiles] Remove the NotificationService from the ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copy paste the right function 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/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 d53c13448bd7ebd709643a828c1e4b38597dc28a..c3424c9d8bf65b6ecff7bf4b0314d6ae0245bc00 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -128,8 +128,7 @@ void ManageProfileHandler::GetLocalizedValues(
}
void ManageProfileHandler::InitializeHandler() {
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
- content::NotificationService::AllSources());
+ g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this);
Profile* profile = Profile::FromWebUI(web_ui());
pref_change_registrar_.Init(profile->GetPrefs());
@@ -189,18 +188,31 @@ void ManageProfileHandler::RegisterMessages() {
}
void ManageProfileHandler::Uninitialize() {
- registrar_.RemoveAll();
+ g_browser_process->profile_manager()->
+ GetProfileInfoCache().RemoveObserver(this);
}
-void ManageProfileHandler::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) {
- SendExistingProfileNames();
- base::StringValue value(kManageProfileIdentifier);
- SendProfileIconsAndNames(value);
- }
+void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) {
+ SendExistingProfileNames();
+}
+
+void ManageProfileHandler::OnProfileWasRemoved(
+ const base::FilePath& profile_path,
+ const base::string16& profile_name) {
+ SendExistingProfileNames();
+}
+
+void ManageProfileHandler::OnProfileNameChanged(
+ const base::FilePath& profile_path,
+ const base::string16& old_profile_name) {
+ base::StringValue value(kManageProfileIdentifier);
+ SendProfileIconsAndNames(value);
+}
+
+void ManageProfileHandler::OnProfileAvatarChanged(
+ const base::FilePath& profile_path) {
+ base::StringValue value(kManageProfileIdentifier);
+ SendProfileIconsAndNames(value);
}
void ManageProfileHandler::OnStateChanged() {

Powered by Google App Engine
This is Rietveld 408576698