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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/browser/chromeos/login/screen_locker.h" 42 #include "chrome/browser/chromeos/login/screen_locker.h"
43 #include "chrome/browser/chromeos/login/user_manager.h" 43 #include "chrome/browser/chromeos/login/user_manager.h"
44 #include "chrome/browser/chromeos/settings/cros_settings.h" 44 #include "chrome/browser/chromeos/settings/cros_settings.h"
45 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 45 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
46 #include "chrome/browser/chromeos/settings/ownership_service.h" 46 #include "chrome/browser/chromeos/settings/ownership_service.h"
47 #include "chrome/browser/extensions/extension_service.h" 47 #include "chrome/browser/extensions/extension_service.h"
48 #include "chrome/browser/first_run/first_run.h" 48 #include "chrome/browser/first_run/first_run.h"
49 #include "chrome/browser/net/chrome_url_request_context.h" 49 #include "chrome/browser/net/chrome_url_request_context.h"
50 #include "chrome/browser/net/preconnect.h" 50 #include "chrome/browser/net/preconnect.h"
51 #include "chrome/browser/policy/browser_policy_connector.h" 51 #include "chrome/browser/policy/browser_policy_connector.h"
52 #include "chrome/browser/policy/cloud_policy_client.h"
53 #include "chrome/browser/policy/cloud_policy_service.h"
54 #include "chrome/browser/policy/user_cloud_policy_manager.h"
55 #include "chrome/browser/prefs/pref_member.h" 52 #include "chrome/browser/prefs/pref_member.h"
56 #include "chrome/browser/prefs/pref_service.h" 53 #include "chrome/browser/prefs/pref_service.h"
57 #include "chrome/browser/profiles/profile.h" 54 #include "chrome/browser/profiles/profile.h"
58 #include "chrome/browser/profiles/profile_manager.h" 55 #include "chrome/browser/profiles/profile_manager.h"
59 #include "chrome/browser/signin/signin_manager.h" 56 #include "chrome/browser/signin/signin_manager.h"
60 #include "chrome/browser/signin/signin_manager_factory.h" 57 #include "chrome/browser/signin/signin_manager_factory.h"
61 #include "chrome/browser/signin/token_service.h" 58 #include "chrome/browser/signin/token_service.h"
62 #include "chrome/browser/signin/token_service_factory.h" 59 #include "chrome/browser/signin/token_service_factory.h"
63 #include "chrome/browser/sync/profile_sync_service.h" 60 #include "chrome/browser/sync/profile_sync_service.h"
64 #include "chrome/browser/sync/profile_sync_service_factory.h" 61 #include "chrome/browser/sync/profile_sync_service_factory.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 bool wait_for_policy_fetch = 480 bool wait_for_policy_fetch =
484 using_oauth_ && 481 using_oauth_ &&
485 authenticator_.get() && 482 authenticator_.get() &&
486 (connector->GetUserAffiliation(username) == 483 (connector->GetUserAffiliation(username) ==
487 policy::USER_AFFILIATION_MANAGED); 484 policy::USER_AFFILIATION_MANAGED);
488 485
489 // Initialize user policy before the profile is created so the profile 486 // Initialize user policy before the profile is created so the profile
490 // initialization code sees the cached policy settings. 487 // initialization code sees the cached policy settings.
491 connector->InitializeUserPolicy(username, wait_for_policy_fetch); 488 connector->InitializeUserPolicy(username, wait_for_policy_fetch);
492 489
493 // The default profile will have been changed because the ProfileManager
494 // will process the notification that the UserManager sends out.
495 ProfileManager::CreateDefaultProfileAsync(
496 base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
497
498 // The default profile is only partially initialized at this point.
499 // Setup the UserCloudPolicyManager so profile initialization can complete.
500 Profile* user_profile = ProfileManager::GetDefaultProfile();
501
502 // Initialize the new cloud policy framework, if enabled.
503 if (user_profile->GetUserCloudPolicyManager()) {
504 user_profile->GetUserCloudPolicyManager()->Initialize(
505 g_browser_process->local_state(),
506 connector->device_management_service(),
507 connector->GetUserAffiliation(username));
508 }
509
510 if (wait_for_policy_fetch) { 490 if (wait_for_policy_fetch) {
511 // Profile creation will block until user policy is fetched, which 491 // Profile creation will block until user policy is fetched, which
512 // requires the DeviceManagement token. Try to fetch it now. 492 // requires the DeviceManagement token. Try to fetch it now.
513 VLOG(1) << "Profile creation requires policy token, fetching now"; 493 VLOG(1) << "Profile creation requires policy token, fetching now";
514 policy_oauth_fetcher_.reset( 494 policy_oauth_fetcher_.reset(
515 new PolicyOAuthFetcher(authenticator_->authentication_profile())); 495 new PolicyOAuthFetcher(authenticator_->authentication_profile()));
516 policy_oauth_fetcher_->Start(); 496 policy_oauth_fetcher_->Start();
517 } 497 }
498
499 // The default profile will have been changed because the ProfileManager
500 // will process the notification that the UserManager sends out.
501 ProfileManager::CreateDefaultProfileAsync(
502 base::Bind(&LoginUtilsImpl::OnProfileCreated, AsWeakPtr()));
518 } 503 }
519 504
520 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { 505 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) {
521 if (delegate_ == delegate) 506 if (delegate_ == delegate)
522 delegate_ = NULL; 507 delegate_ = NULL;
523 } 508 }
524 509
525 void LoginUtilsImpl::OnProfileCreated( 510 void LoginUtilsImpl::OnProfileCreated(
526 Profile* user_profile, 511 Profile* user_profile,
527 Profile::CreateStatus status) { 512 Profile::CreateStatus status) {
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 bool LoginUtils::IsWhitelisted(const std::string& username) { 1189 bool LoginUtils::IsWhitelisted(const std::string& username) {
1205 CrosSettings* cros_settings = CrosSettings::Get(); 1190 CrosSettings* cros_settings = CrosSettings::Get();
1206 bool allow_new_user = false; 1191 bool allow_new_user = false;
1207 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1192 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1208 if (allow_new_user) 1193 if (allow_new_user)
1209 return true; 1194 return true;
1210 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 1195 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
1211 } 1196 }
1212 1197
1213 } // namespace chromeos 1198 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/chromeos/login/login_utils_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698