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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 11415094: Split UserCloudPolicyManager implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebae Created 8 years, 1 month 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/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/chromeos/settings/cros_settings.h" 46 #include "chrome/browser/chromeos/settings/cros_settings.h"
47 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 47 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
48 #include "chrome/browser/extensions/extension_service.h" 48 #include "chrome/browser/extensions/extension_service.h"
49 #include "chrome/browser/first_run/first_run.h" 49 #include "chrome/browser/first_run/first_run.h"
50 #include "chrome/browser/net/chrome_url_request_context.h" 50 #include "chrome/browser/net/chrome_url_request_context.h"
51 #include "chrome/browser/net/preconnect.h" 51 #include "chrome/browser/net/preconnect.h"
52 #include "chrome/browser/policy/browser_policy_connector.h" 52 #include "chrome/browser/policy/browser_policy_connector.h"
53 #include "chrome/browser/policy/cloud_policy_client.h" 53 #include "chrome/browser/policy/cloud_policy_client.h"
54 #include "chrome/browser/policy/cloud_policy_service.h" 54 #include "chrome/browser/policy/cloud_policy_service.h"
55 #include "chrome/browser/policy/network_configuration_updater.h" 55 #include "chrome/browser/policy/network_configuration_updater.h"
56 #include "chrome/browser/policy/user_cloud_policy_manager.h"
57 #include "chrome/browser/prefs/pref_service.h" 56 #include "chrome/browser/prefs/pref_service.h"
58 #include "chrome/browser/profiles/profile.h" 57 #include "chrome/browser/profiles/profile.h"
59 #include "chrome/browser/profiles/profile_manager.h" 58 #include "chrome/browser/profiles/profile_manager.h"
60 #include "chrome/browser/signin/signin_manager.h" 59 #include "chrome/browser/signin/signin_manager.h"
61 #include "chrome/browser/signin/signin_manager_factory.h" 60 #include "chrome/browser/signin/signin_manager_factory.h"
62 #include "chrome/browser/signin/token_service.h" 61 #include "chrome/browser/signin/token_service.h"
63 #include "chrome/browser/signin/token_service_factory.h" 62 #include "chrome/browser/signin/token_service_factory.h"
64 #include "chrome/browser/sync/profile_sync_service.h" 63 #include "chrome/browser/sync/profile_sync_service.h"
65 #include "chrome/browser/sync/profile_sync_service_factory.h" 64 #include "chrome/browser/sync/profile_sync_service_factory.h"
66 #include "chrome/browser/ui/startup/startup_browser_creator.h" 65 #include "chrome/browser/ui/startup/startup_browser_creator.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 491
493 // Initialize user policy before the profile is created so the profile 492 // Initialize user policy before the profile is created so the profile
494 // initialization code sees the cached policy settings. 493 // initialization code sees the cached policy settings.
495 connector->InitializeUserPolicy(username, wait_for_policy_fetch); 494 connector->InitializeUserPolicy(username, wait_for_policy_fetch);
496 495
497 // The default profile will have been changed because the ProfileManager 496 // The default profile will have been changed because the ProfileManager
498 // will process the notification that the UserManager sends out. 497 // will process the notification that the UserManager sends out.
499 ProfileManager::CreateDefaultProfileAsync( 498 ProfileManager::CreateDefaultProfileAsync(
500 base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr())); 499 base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
501 500
502 // The default profile is only partially initialized at this point.
503 // Setup the UserCloudPolicyManager so profile initialization can complete.
504 Profile* user_profile = ProfileManager::GetDefaultProfile();
505
506 // Initialize the new cloud policy framework, if enabled.
507 if (user_profile->GetUserCloudPolicyManager()) {
508 user_profile->GetUserCloudPolicyManager()->Initialize(
509 g_browser_process->local_state(),
510 connector->device_management_service(),
511 connector->GetUserAffiliation(username));
512 }
513
514 if (wait_for_policy_fetch) { 501 if (wait_for_policy_fetch) {
515 // Profile creation will block until user policy is fetched, which 502 // Profile creation will block until user policy is fetched, which
516 // requires the DeviceManagement token. Try to fetch it now. 503 // requires the DeviceManagement token. Try to fetch it now.
517 // TODO(atwilson): This is somewhat racy, as we are trying to fetch a 504 // TODO(atwilson): This is somewhat racy, as we are trying to fetch a
518 // DMToken in parallel with loading the cached policy blob (there could 505 // DMToken in parallel with loading the cached policy blob (there could
519 // already be a DMToken in the cached policy). Once the legacy policy 506 // already be a DMToken in the cached policy). Once the legacy policy
520 // framework is removed, this code can register a 507 // framework is removed, this code can register a
521 // CloudPolicyService::Observer to check whether the CloudPolicyClient was 508 // CloudPolicyService::Observer to check whether the CloudPolicyClient was
522 // able to register itself using the cached policy data, and then only 509 // able to register itself using the cached policy data, and then only
523 // create a PolicyOAuthFetcher if the client is still unregistered 510 // create a PolicyOAuthFetcher if the client is still unregistered
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 bool LoginUtils::IsWhitelisted(const std::string& username) { 1235 bool LoginUtils::IsWhitelisted(const std::string& username) {
1249 CrosSettings* cros_settings = CrosSettings::Get(); 1236 CrosSettings* cros_settings = CrosSettings::Get();
1250 bool allow_new_user = false; 1237 bool allow_new_user = false;
1251 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1238 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1252 if (allow_new_user) 1239 if (allow_new_user)
1253 return true; 1240 return true;
1254 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 1241 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
1255 } 1242 }
1256 1243
1257 } // namespace chromeos 1244 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698