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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chromeos/chromeos_paths.h" | 27 #include "chromeos/chromeos_paths.h" |
28 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
29 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
30 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 30 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
31 #include "components/policy/core/browser/browser_policy_connector.h" | 31 #include "components/policy/core/browser/browser_policy_connector.h" |
32 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 32 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
33 #include "components/policy/core/common/cloud/device_management_service.h" | 33 #include "components/policy/core/common/cloud/device_management_service.h" |
34 #include "components/user_manager/user.h" | 34 #include "components/user_manager/user.h" |
35 #include "components/user_manager/user_manager.h" | 35 #include "components/user_manager/user_manager.h" |
36 #include "components/user_manager/user_type.h" | 36 #include "components/user_manager/user_type.h" |
bartfab (slow)
2014/11/11 19:42:06
Nit: No longer used.
merkulova
2014/11/12 10:01:01
Done.
| |
37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
38 #include "net/url_request/url_request_context_getter.h" | 38 #include "net/url_request/url_request_context_getter.h" |
39 #include "policy/policy_constants.h" | 39 #include "policy/policy_constants.h" |
40 | 40 |
41 namespace policy { | 41 namespace policy { |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 // Subdirectory in the user's profile for storing legacy user policies. | 45 // Subdirectory in the user's profile for storing legacy user policies. |
46 const base::FilePath::CharType kDeviceManagementDir[] = | 46 const base::FilePath::CharType kDeviceManagementDir[] = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 if (chromeos::ProfileHelper::IsSigninProfile(profile)) | 122 if (chromeos::ProfileHelper::IsSigninProfile(profile)) |
123 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); | 123 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); |
124 | 124 |
125 // |user| should never be NULL except for the signin profile. This object is | 125 // |user| should never be NULL except for the signin profile. This object is |
126 // created as part of the Profile creation, which happens right after | 126 // created as part of the Profile creation, which happens right after |
127 // sign-in. The just-signed-in User is the active user during that time. | 127 // sign-in. The just-signed-in User is the active user during that time. |
128 user_manager::User* user = | 128 user_manager::User* user = |
129 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 129 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
130 CHECK(user); | 130 CHECK(user); |
131 | 131 |
132 // Only USER_TYPE_REGULAR users have user cloud policy. | 132 // Only USER_TYPE_REGULAR and USER_TYPE_REGULAR_SUPERVISED users have user |
133 // USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP, USER_TYPE_GUEST and | 133 // cloud policy. USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP, USER_TYPE_GUEST |
134 // USER_TYPE_SUPERVISED are not signed in and can't authenticate the | 134 // and USER_TYPE_SUPERVISED are not signed in and can't authenticate the |
135 // policy registration. | 135 // policy registration. |
136 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the | 136 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the |
137 // DeviceLocalAccountPolicyService. | 137 // DeviceLocalAccountPolicyService. |
138 // Non-managed domains will be skipped by the below check | 138 // Non-managed domains will be skipped by the below check |
139 const std::string& username = user->email(); | 139 const std::string& username = user->email(); |
140 if (user->GetType() != user_manager::USER_TYPE_REGULAR || | 140 if (!user->IsRegular() || |
141 BrowserPolicyConnector::IsNonEnterpriseUser(username)) { | 141 BrowserPolicyConnector::IsNonEnterpriseUser(username)) { |
142 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); | 142 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); |
143 } | 143 } |
144 | 144 |
145 policy::BrowserPolicyConnectorChromeOS* connector = | 145 policy::BrowserPolicyConnectorChromeOS* connector = |
146 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 146 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
147 UserAffiliation affiliation = connector->GetUserAffiliation(username); | 147 UserAffiliation affiliation = connector->GetUserAffiliation(username); |
148 const bool is_affiliated_user = affiliation == USER_AFFILIATION_MANAGED; | 148 const bool is_affiliated_user = affiliation == USER_AFFILIATION_MANAGED; |
149 const bool is_browser_restart = | 149 const bool is_browser_restart = |
150 command_line->HasSwitch(chromeos::switches::kLoginUser); | 150 command_line->HasSwitch(chromeos::switches::kLoginUser); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 | 252 |
253 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( | 253 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( |
254 content::BrowserContext* context) { | 254 content::BrowserContext* context) { |
255 return false; | 255 return false; |
256 } | 256 } |
257 | 257 |
258 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 258 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
259 content::BrowserContext* context) {} | 259 content::BrowserContext* context) {} |
260 | 260 |
261 } // namespace policy | 261 } // namespace policy |
OLD | NEW |