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/user_policy_signin_service.h" | 5 #include "chrome/browser/policy/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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/policy/browser_policy_connector.h" | 13 #include "chrome/browser/policy/browser_policy_connector.h" |
14 #include "chrome/browser/policy/cloud_policy_client.h" | 14 #include "chrome/browser/policy/cloud_policy_client.h" |
15 #include "chrome/browser/policy/cloud_policy_service.h" | 15 #include "chrome/browser/policy/cloud_policy_service.h" |
16 #include "chrome/browser/policy/user_cloud_policy_manager.h" | 16 #include "chrome/browser/policy/user_cloud_policy_manager.h" |
17 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" | 17 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" |
18 #include "chrome/browser/policy/user_info_fetcher.h" | 18 #include "chrome/browser/policy/user_info_fetcher.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/signin/signin_manager.h" | 21 #include "chrome/browser/signin/signin_manager.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/signin/token_service.h" | 23 #include "chrome/browser/signin/token_service.h" |
23 #include "chrome/browser/signin/token_service_factory.h" | 24 #include "chrome/browser/signin/token_service_factory.h" |
24 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
27 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
29 #include "google_apis/gaia/gaia_constants.h" | 30 #include "google_apis/gaia/gaia_constants.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void CloudPolicyClientRegistrationHelper::OnClientError( | 221 void CloudPolicyClientRegistrationHelper::OnClientError( |
221 policy::CloudPolicyClient* client) { | 222 policy::CloudPolicyClient* client) { |
222 DVLOG(1) << "Client registration failed"; | 223 DVLOG(1) << "Client registration failed"; |
223 DCHECK_EQ(client, client_); | 224 DCHECK_EQ(client, client_); |
224 RequestCompleted(); | 225 RequestCompleted(); |
225 } | 226 } |
226 | 227 |
227 UserPolicySigninService::UserPolicySigninService( | 228 UserPolicySigninService::UserPolicySigninService( |
228 Profile* profile) | 229 Profile* profile) |
229 : profile_(profile) { | 230 : profile_(profile) { |
230 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin)) | 231 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 232 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin) || |
| 233 ProfileManager::IsImportProcess(*cmd_line)) { |
231 return; | 234 return; |
| 235 } |
232 | 236 |
233 // Initialize/shutdown the UserCloudPolicyManager when the user signs out. | 237 // Initialize/shutdown the UserCloudPolicyManager when the user signs out. |
234 registrar_.Add(this, | 238 registrar_.Add(this, |
235 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 239 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
236 content::Source<Profile>(profile)); | 240 content::Source<Profile>(profile)); |
237 | 241 |
238 // Listen for an OAuth token to become available so we can register a client | 242 // Listen for an OAuth token to become available so we can register a client |
239 // if for some reason the client is not already registered (for example, if | 243 // if for some reason the client is not already registered (for example, if |
240 // the policy load failed during initial signin). | 244 // the policy load failed during initial signin). |
241 registrar_.Add(this, | 245 registrar_.Add(this, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // before UserCloudPolicyManager shuts down the CloudPolicyClient. | 535 // before UserCloudPolicyManager shuts down the CloudPolicyClient. |
532 registration_helper_.reset(); | 536 registration_helper_.reset(); |
533 StopObserving(); | 537 StopObserving(); |
534 } | 538 } |
535 | 539 |
536 UserCloudPolicyManager* UserPolicySigninService::GetManager() { | 540 UserCloudPolicyManager* UserPolicySigninService::GetManager() { |
537 return UserCloudPolicyManagerFactory::GetForProfile(profile_); | 541 return UserCloudPolicyManagerFactory::GetForProfile(profile_); |
538 } | 542 } |
539 | 543 |
540 } // namespace policy | 544 } // namespace policy |
OLD | NEW |