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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc

Issue 718673002: New user type introduced. Combines regular and supervised features. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Logical expression fixed. Created 6 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
OLDNEW
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
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"
37 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
38 #include "net/url_request/url_request_context_getter.h" 37 #include "net/url_request/url_request_context_getter.h"
39 #include "policy/policy_constants.h" 38 #include "policy/policy_constants.h"
40 39
41 namespace policy { 40 namespace policy {
42 41
43 namespace { 42 namespace {
44 43
45 // Subdirectory in the user's profile for storing legacy user policies. 44 // Subdirectory in the user's profile for storing legacy user policies.
46 const base::FilePath::CharType kDeviceManagementDir[] = 45 const base::FilePath::CharType kDeviceManagementDir[] =
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (chromeos::ProfileHelper::IsSigninProfile(profile)) 121 if (chromeos::ProfileHelper::IsSigninProfile(profile))
123 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); 122 return scoped_ptr<UserCloudPolicyManagerChromeOS>();
124 123
125 // |user| should never be NULL except for the signin profile. This object is 124 // |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 125 // 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. 126 // sign-in. The just-signed-in User is the active user during that time.
128 user_manager::User* user = 127 user_manager::User* user =
129 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 128 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
130 CHECK(user); 129 CHECK(user);
131 130
132 // Only USER_TYPE_REGULAR users have user cloud policy. 131 // Only users with gaia accounts have user cloud policy.
133 // USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP, USER_TYPE_GUEST and 132 // USER_TYPE_RETAIL_MODE, USER_TYPE_KIOSK_APP, USER_TYPE_GUEST
bartfab (slow) 2014/11/27 12:51:50 This is actually out of date. USER_TYPE_KIOSK_APP
134 // USER_TYPE_SUPERVISED are not signed in and can't authenticate the 133 // and USER_TYPE_SUPERVISED are not signed in and can't authenticate the
135 // policy registration. 134 // policy registration.
136 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the 135 // USER_TYPE_PUBLIC_ACCOUNT gets its policy from the
137 // DeviceLocalAccountPolicyService. 136 // DeviceLocalAccountPolicyService.
138 // Non-managed domains will be skipped by the below check 137 // Non-managed domains will be skipped by the below check
139 const std::string& username = user->email(); 138 const std::string& username = user->email();
140 if (user->GetType() != user_manager::USER_TYPE_REGULAR || 139 if (!user->HasGaiaAccount() ||
141 BrowserPolicyConnector::IsNonEnterpriseUser(username)) { 140 BrowserPolicyConnector::IsNonEnterpriseUser(username)) {
142 return scoped_ptr<UserCloudPolicyManagerChromeOS>(); 141 return scoped_ptr<UserCloudPolicyManagerChromeOS>();
143 } 142 }
144 143
145 policy::BrowserPolicyConnectorChromeOS* connector = 144 policy::BrowserPolicyConnectorChromeOS* connector =
146 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 145 g_browser_process->platform_part()->browser_policy_connector_chromeos();
147 UserAffiliation affiliation = connector->GetUserAffiliation(username); 146 UserAffiliation affiliation = connector->GetUserAffiliation(username);
148 const bool is_affiliated_user = affiliation == USER_AFFILIATION_MANAGED; 147 const bool is_affiliated_user = affiliation == USER_AFFILIATION_MANAGED;
149 const bool is_browser_restart = 148 const bool is_browser_restart =
150 command_line->HasSwitch(chromeos::switches::kLoginUser); 149 command_line->HasSwitch(chromeos::switches::kLoginUser);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 251
253 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( 252 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory(
254 content::BrowserContext* context) { 253 content::BrowserContext* context) {
255 return false; 254 return false;
256 } 255 }
257 256
258 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( 257 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow(
259 content::BrowserContext* context) {} 258 content::BrowserContext* context) {}
260 259
261 } // namespace policy 260 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698