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

Side by Side Diff: chrome/browser/policy/user_policy_signin_service.cc

Issue 12330073: Disable ProfileKeyedServices on import process by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to ToT Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
21 #include "chrome/browser/signin/signin_manager.h" 20 #include "chrome/browser/signin/signin_manager.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/signin/token_service.h" 22 #include "chrome/browser/signin/token_service.h"
24 #include "chrome/browser/signin/token_service_factory.h" 23 #include "chrome/browser/signin/token_service_factory.h"
25 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
28 #include "content/public/browser/notification_details.h" 27 #include "content/public/browser/notification_details.h"
29 #include "content/public/browser/notification_source.h" 28 #include "content/public/browser/notification_source.h"
30 #include "google_apis/gaia/gaia_constants.h" 29 #include "google_apis/gaia/gaia_constants.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void CloudPolicyClientRegistrationHelper::OnClientError( 220 void CloudPolicyClientRegistrationHelper::OnClientError(
222 policy::CloudPolicyClient* client) { 221 policy::CloudPolicyClient* client) {
223 DVLOG(1) << "Client registration failed"; 222 DVLOG(1) << "Client registration failed";
224 DCHECK_EQ(client, client_); 223 DCHECK_EQ(client, client_);
225 RequestCompleted(); 224 RequestCompleted();
226 } 225 }
227 226
228 UserPolicySigninService::UserPolicySigninService( 227 UserPolicySigninService::UserPolicySigninService(
229 Profile* profile) 228 Profile* profile)
230 : profile_(profile) { 229 : profile_(profile) {
231 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
232 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin) ||
233 ProfileManager::IsImportProcess(*cmd_line)) {
234 return;
235 }
236
237 // Initialize/shutdown the UserCloudPolicyManager when the user signs out. 230 // Initialize/shutdown the UserCloudPolicyManager when the user signs out.
238 registrar_.Add(this, 231 registrar_.Add(this,
239 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, 232 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
240 content::Source<Profile>(profile)); 233 content::Source<Profile>(profile));
241 234
242 // Listen for an OAuth token to become available so we can register a client 235 // Listen for an OAuth token to become available so we can register a client
243 // if for some reason the client is not already registered (for example, if 236 // if for some reason the client is not already registered (for example, if
244 // the policy load failed during initial signin). 237 // the policy load failed during initial signin).
245 registrar_.Add(this, 238 registrar_.Add(this,
246 chrome::NOTIFICATION_TOKEN_AVAILABLE, 239 chrome::NOTIFICATION_TOKEN_AVAILABLE,
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // before UserCloudPolicyManager shuts down the CloudPolicyClient. 528 // before UserCloudPolicyManager shuts down the CloudPolicyClient.
536 registration_helper_.reset(); 529 registration_helper_.reset();
537 StopObserving(); 530 StopObserving();
538 } 531 }
539 532
540 UserCloudPolicyManager* UserPolicySigninService::GetManager() { 533 UserCloudPolicyManager* UserPolicySigninService::GetManager() {
541 return UserCloudPolicyManagerFactory::GetForProfile(profile_); 534 return UserCloudPolicyManagerFactory::GetForProfile(profile_);
542 } 535 }
543 536
544 } // namespace policy 537 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698