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 b2b2544220f96db5529078cbc010d8d2ba40ce53..c5f260b1f2a0a6614d98beecb1da73467b73f8d2 100644 |
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
@@ -20,6 +20,8 @@ |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/profiles/profile_metrics.h" |
+#include "chrome/browser/signin/signin_manager.h" |
+#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/ui/browser.h" |
@@ -91,6 +93,10 @@ void NTPLoginHandler::RegisterMessages() { |
pref_service, |
base::Bind(&NTPLoginHandler::UpdateLogin, |
base::Unretained(this))); |
+ signin_allowed_pref_.Init(prefs::kSigninAllowed, |
+ pref_service, |
+ base::Bind(&NTPLoginHandler::UpdateLogin, |
+ base::Unretained(this))); |
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
content::NotificationService::AllSources()); |
@@ -252,7 +258,8 @@ bool NTPLoginHandler::ShouldShow(Profile* profile) { |
// UI and the avatar menu don't exist on that platform. |
return false; |
#else |
- return !profile->IsOffTheRecord(); |
+ SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |
+ return !profile->IsOffTheRecord() && signin && signin->IsSigninAllowed(); |
#endif |
} |