Chromium Code Reviews| Index: chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
| diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
| index e9b8a9a3f7027547cf41f369fcc0ea97ce03bcc5..052ae1afe7f76e571a329f260ec07313c9e3d5fe 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
| +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
| @@ -14,7 +14,6 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "chrome/browser/browser_process.h" |
| -#include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_info_cache.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| @@ -35,8 +34,6 @@ |
| #include "chrome/grit/generated_resources.h" |
| #include "components/signin/core/browser/signin_manager.h" |
| #include "content/public/browser/host_zoom_map.h" |
| -#include "content/public/browser/notification_details.h" |
| -#include "content/public/browser/notification_service.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_ui.h" |
| #include "content/public/common/page_zoom.h" |
| @@ -79,9 +76,12 @@ base::string16 CreateSpanWithClass(const base::string16& content, |
| } // namespace |
| NTPLoginHandler::NTPLoginHandler() { |
| + g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); |
|
rpetterson
2015/02/07 00:04:58
What about making a static function for this? I th
noms (inactive)
2015/02/12 21:46:02
Hmm, I'm not sure if that would be confusing. We s
|
| } |
| NTPLoginHandler::~NTPLoginHandler() { |
| + g_browser_process->profile_manager()-> |
| + GetProfileInfoCache().RemoveObserver(this); |
| } |
| void NTPLoginHandler::RegisterMessages() { |
| @@ -91,9 +91,6 @@ void NTPLoginHandler::RegisterMessages() { |
| base::Bind(&NTPLoginHandler::UpdateLogin, |
| base::Unretained(this))); |
| - registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
| - content::NotificationService::AllSources()); |
| - |
| web_ui()->RegisterMessageCallback("initializeSyncLogin", |
| base::Bind(&NTPLoginHandler::HandleInitializeSyncLogin, |
| base::Unretained(this))); |
| @@ -108,10 +105,8 @@ void NTPLoginHandler::RegisterMessages() { |
| base::Unretained(this))); |
| } |
| -void NTPLoginHandler::Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| - DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, type); |
| +void NTPLoginHandler::OnProfileUserNameChanged( |
| + const base::FilePath& profile_path) { |
| UpdateLogin(); |
| } |