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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 // If this is an enterprise device and the user belongs to the enterprise | 737 // If this is an enterprise device and the user belongs to the enterprise |
738 // domain, then wait for a policy fetch before logging the user in. This | 738 // domain, then wait for a policy fetch before logging the user in. This |
739 // will delay Profile creation until the policy is fetched, so that features | 739 // will delay Profile creation until the policy is fetched, so that features |
740 // controlled by policy (e.g. Sync, Startup tabs) only start after the | 740 // controlled by policy (e.g. Sync, Startup tabs) only start after the |
741 // PrefService has the right values. | 741 // PrefService has the right values. |
742 // Profile creation is also resumed if the fetch attempt fails. | 742 // Profile creation is also resumed if the fetch attempt fails. |
743 bool wait_for_policy_fetch = | 743 bool wait_for_policy_fetch = |
744 using_oauth_ && | 744 using_oauth_ && |
745 authenticator_.get() && | 745 authenticator_.get() && |
746 (connector->GetUserAffiliation(username) == | 746 (connector->GetUserAffiliation(username) == |
747 policy::CloudPolicyDataStore::USER_AFFILIATION_MANAGED); | 747 policy::USER_AFFILIATION_MANAGED); |
748 | 748 |
749 // Initialize user policy before the profile is created so the profile | 749 // Initialize user policy before the profile is created so the profile |
750 // initialization code sees the cached policy settings. | 750 // initialization code sees the cached policy settings. |
751 connector->InitializeUserPolicy(username, wait_for_policy_fetch); | 751 connector->InitializeUserPolicy(username, wait_for_policy_fetch); |
752 | 752 |
753 if (wait_for_policy_fetch) { | 753 if (wait_for_policy_fetch) { |
754 // Profile creation will block until user policy is fetched, which | 754 // Profile creation will block until user policy is fetched, which |
755 // requires the DeviceManagement token. Try to fetch it now. | 755 // requires the DeviceManagement token. Try to fetch it now. |
756 VLOG(1) << "Profile creation requires policy token, fetching now"; | 756 VLOG(1) << "Profile creation requires policy token, fetching now"; |
757 policy_oauth_fetcher_.reset( | 757 policy_oauth_fetcher_.reset( |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 bool LoginUtils::IsWhitelisted(const std::string& username) { | 1356 bool LoginUtils::IsWhitelisted(const std::string& username) { |
1357 CrosSettings* cros_settings = CrosSettings::Get(); | 1357 CrosSettings* cros_settings = CrosSettings::Get(); |
1358 bool allow_new_user = false; | 1358 bool allow_new_user = false; |
1359 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1359 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
1360 if (allow_new_user) | 1360 if (allow_new_user) |
1361 return true; | 1361 return true; |
1362 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 1362 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
1363 } | 1363 } |
1364 | 1364 |
1365 } // namespace chromeos | 1365 } // namespace chromeos |
OLD | NEW |