| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); | 97 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); |
| 98 | 98 |
| 99 // |user| should never be NULL except for the signin profile. This object is | 99 // |user| should never be NULL except for the signin profile. This object is |
| 100 // created as part of the Profile creation, which happens right after | 100 // created as part of the Profile creation, which happens right after |
| 101 // sign-in. The just-signed-in User is the active user during that time. | 101 // sign-in. The just-signed-in User is the active user during that time. |
| 102 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 102 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
| 103 chromeos::User* user = user_manager->GetActiveUser(); | 103 chromeos::User* user = user_manager->GetActiveUser(); |
| 104 CHECK(user); | 104 CHECK(user); |
| 105 | 105 |
| 106 // Only USER_TYPE_REGULAR users have user cloud policy. | 106 // Only USER_TYPE_REGULAR users have user cloud policy. |
| 107 // USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP and USER_TYPE_GUEST are not | 107 // USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP, USER_TYPE_GUEST and |
| 108 // signed in and can't authenticate the policy registration. | 108 // USER_TYPE_LOCALLY_MANAGED are not signed in and can't authenticate the |
| 109 // policy registration. |
| 109 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the | 110 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the |
| 110 // DeviceLocalAccountPolicyService. | 111 // DeviceLocalAccountPolicyService. |
| 111 // USER_TYPE_LOCALLY_MANAGED gets its policy from the | |
| 112 // ManagedModePolicyProvider. | |
| 113 const std::string& username = user->email(); | 112 const std::string& username = user->email(); |
| 114 if (user->GetType() != chromeos::User::USER_TYPE_REGULAR || | 113 if (user->GetType() != chromeos::User::USER_TYPE_REGULAR || |
| 115 BrowserPolicyConnector::IsNonEnterpriseUser(username)) { | 114 BrowserPolicyConnector::IsNonEnterpriseUser(username)) { |
| 116 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); | 115 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 BrowserPolicyConnector* connector = | 118 BrowserPolicyConnector* connector = |
| 120 g_browser_process->browser_policy_connector(); | 119 g_browser_process->browser_policy_connector(); |
| 121 UserAffiliation affiliation = connector->GetUserAffiliation(username); | 120 UserAffiliation affiliation = connector->GetUserAffiliation(username); |
| 122 const bool is_managed_user = affiliation == USER_AFFILIATION_MANAGED; | 121 const bool is_managed_user = affiliation == USER_AFFILIATION_MANAGED; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); | 184 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); |
| 186 } | 185 } |
| 187 | 186 |
| 188 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( | 187 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( |
| 189 content::BrowserContext* context) {} | 188 content::BrowserContext* context) {} |
| 190 | 189 |
| 191 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 190 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 192 content::BrowserContext* context) {} | 191 content::BrowserContext* context) {} |
| 193 | 192 |
| 194 } // namespace policy | 193 } // namespace policy |
| OLD | NEW |