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

Unified Diff: chrome/browser/policy/user_policy_signin_service.cc

Issue 12088022: Enable cloud policy by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Tests do the craziest damn things. Created 7 years, 11 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/policy/user_policy_signin_service.cc
diff --git a/chrome/browser/policy/user_policy_signin_service.cc b/chrome/browser/policy/user_policy_signin_service.cc
index a56644f5d577a1d5473050d92d025d7bd9ab1f91..d4b5075d3d53076d3613fdd928a80acc5dec9948 100644
--- a/chrome/browser/policy/user_policy_signin_service.cc
+++ b/chrome/browser/policy/user_policy_signin_service.cc
@@ -48,7 +48,7 @@ UserPolicySigninService::UserPolicySigninService(
profile_(profile),
pending_fetch_(false) {
- if (!profile_->GetPrefs()->GetBoolean(prefs::kLoadCloudPolicyOnSignin))
+ if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin))
return;
// Initialize/shutdown the UserCloudPolicyManager when the user signs out.
@@ -138,6 +138,13 @@ void UserPolicySigninService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ // If using a TestingProfile with no SigninManager or UserCloudPolicyManager,
+ // skip initialization.
+ if (!GetManager() || !SigninManagerFactory::GetForProfile(profile_)) {
+ DVLOG(1) << "Skipping initialization for tests due to missing components.";
+ return;
+ }
+
switch (type) {
case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT:
ShutdownUserCloudPolicyManager();
@@ -177,7 +184,7 @@ void UserPolicySigninService::Observe(
}
bool UserPolicySigninService::ShouldLoadPolicyForSignedInUser() {
- if (!profile_->GetPrefs()->GetBoolean(prefs::kLoadCloudPolicyOnSignin))
+ if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin))
return false; // Cloud policy is disabled.
const std::string& username = SigninManagerFactory::GetForProfile(profile_)->

Powered by Google App Engine
This is Rietveld 408576698