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

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 nits 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 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
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_login_handler.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698