OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" | 5 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 policy::CloudPolicyClient* client) { | 219 policy::CloudPolicyClient* client) { |
220 DVLOG(1) << "Client registration failed"; | 220 DVLOG(1) << "Client registration failed"; |
221 DCHECK_EQ(client, client_); | 221 DCHECK_EQ(client, client_); |
222 RequestCompleted(); | 222 RequestCompleted(); |
223 } | 223 } |
224 | 224 |
225 UserPolicySigninService::UserPolicySigninService( | 225 UserPolicySigninService::UserPolicySigninService( |
226 Profile* profile) | 226 Profile* profile) |
227 : profile_(profile), | 227 : profile_(profile), |
228 weak_factory_(this) { | 228 weak_factory_(this) { |
229 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 229 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin)) |
230 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin) || | |
231 ProfileManager::IsImportProcess(*cmd_line)) { | |
232 return; | 230 return; |
233 } | |
234 | 231 |
235 // Initialize/shutdown the UserCloudPolicyManager when the user signs out. | 232 // Initialize/shutdown the UserCloudPolicyManager when the user signs out. |
236 registrar_.Add(this, | 233 registrar_.Add(this, |
237 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 234 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
238 content::Source<Profile>(profile)); | 235 content::Source<Profile>(profile)); |
239 | 236 |
240 // Listen for an OAuth token to become available so we can register a client | 237 // Listen for an OAuth token to become available so we can register a client |
241 // if for some reason the client is not already registered (for example, if | 238 // if for some reason the client is not already registered (for example, if |
242 // the policy load failed during initial signin). | 239 // the policy load failed during initial signin). |
243 registrar_.Add(this, | 240 registrar_.Add(this, |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // before UserCloudPolicyManager shuts down the CloudPolicyClient. | 582 // before UserCloudPolicyManager shuts down the CloudPolicyClient. |
586 registration_helper_.reset(); | 583 registration_helper_.reset(); |
587 StopObserving(); | 584 StopObserving(); |
588 } | 585 } |
589 | 586 |
590 UserCloudPolicyManager* UserPolicySigninService::GetManager() { | 587 UserCloudPolicyManager* UserPolicySigninService::GetManager() { |
591 return UserCloudPolicyManagerFactory::GetForProfile(profile_); | 588 return UserCloudPolicyManagerFactory::GetForProfile(profile_); |
592 } | 589 } |
593 | 590 |
594 } // namespace policy | 591 } // namespace policy |
OLD | NEW |