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

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: Review feedback 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..a767156ebd99b0c73da1e9f08d6d61e94f7b167e 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.
@@ -78,6 +78,8 @@ UserPolicySigninService::UserPolicySigninService(
// Make sure we've initialized the DeviceManagementService. It's OK to
// call this multiple times so we do it every time we create an instance of
// this class (every time a new profile is loaded).
+ // TODO(atwilson): Move this to BrowserPolicyConnector::Init()
+ // (http://crbug.com/165468).
g_browser_process->browser_policy_connector()->
ScheduleServiceInitialization(
kPolicyServiceInitializationDelayMilliseconds);
@@ -138,6 +140,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 +186,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_)->
« no previous file with comments | « chrome/browser/policy/cloud_policy_browsertest.cc ('k') | chrome/browser/policy/user_policy_signin_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698