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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments and rebase to ToT. Created 7 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/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 7062aad3fb1b76b87b2a2e3699edcc8f83c2a5dd..55955ac60b86e49152046d8a5e365b3b90ee1827 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());
@@ -250,7 +256,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
}

Powered by Google App Engine
This is Rietveld 408576698