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

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

Issue 2606773002: Setup Chromad user policy plumbing (Closed)
Patch Set: Compilation fixes Created 3 years, 11 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
16 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
17 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
22 #include "chrome/browser/chromeos/policy/user_active_directory_policy_manager.h"
21 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" 23 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h"
22 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 24 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
23 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" 25 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h"
24 #include "chrome/browser/chromeos/profiles/profile_helper.h" 26 #include "chrome/browser/chromeos/profiles/profile_helper.h"
25 #include "chrome/browser/chromeos/settings/cros_settings.h" 27 #include "chrome/browser/chromeos/settings/cros_settings.h"
28 #include "chrome/browser/chromeos/settings/install_attributes.h"
26 #include "chrome/browser/policy/schema_registry_service.h" 29 #include "chrome/browser/policy/schema_registry_service.h"
27 #include "chrome/browser/policy/schema_registry_service_factory.h" 30 #include "chrome/browser/policy/schema_registry_service_factory.h"
28 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
29 #include "chromeos/chromeos_paths.h" 32 #include "chromeos/chromeos_paths.h"
30 #include "chromeos/chromeos_switches.h" 33 #include "chromeos/chromeos_switches.h"
31 #include "chromeos/dbus/dbus_thread_manager.h" 34 #include "chromeos/dbus/dbus_thread_manager.h"
32 #include "components/keyed_service/content/browser_context_dependency_manager.h" 35 #include "components/keyed_service/content/browser_context_dependency_manager.h"
33 #include "components/policy/core/browser/browser_policy_connector.h" 36 #include "components/policy/core/browser/browser_policy_connector.h"
34 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 37 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
35 #include "components/policy/core/common/cloud/device_management_service.h" 38 #include "components/policy/core/common/cloud/device_management_service.h"
39 #include "components/policy/core/common/configuration_policy_provider.h"
36 #include "components/policy/policy_constants.h" 40 #include "components/policy/policy_constants.h"
37 #include "components/user_manager/user.h" 41 #include "components/user_manager/user.h"
38 #include "components/user_manager/user_manager.h" 42 #include "components/user_manager/user_manager.h"
39 #include "content/public/browser/browser_thread.h" 43 #include "content/public/browser/browser_thread.h"
40 #include "net/url_request/url_request_context_getter.h" 44 #include "net/url_request/url_request_context_getter.h"
41 45
42 namespace policy { 46 namespace policy {
43 47
44 namespace { 48 namespace {
45 49
(...skipping 17 matching lines...) Expand all
63 67
64 } // namespace 68 } // namespace
65 69
66 // static 70 // static
67 UserCloudPolicyManagerFactoryChromeOS* 71 UserCloudPolicyManagerFactoryChromeOS*
68 UserCloudPolicyManagerFactoryChromeOS::GetInstance() { 72 UserCloudPolicyManagerFactoryChromeOS::GetInstance() {
69 return base::Singleton<UserCloudPolicyManagerFactoryChromeOS>::get(); 73 return base::Singleton<UserCloudPolicyManagerFactoryChromeOS>::get();
70 } 74 }
71 75
72 // static 76 // static
77 ConfigurationPolicyProvider*
78 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(Profile* profile) {
79 ConfigurationPolicyProvider* cloud_provider =
80 GetInstance()->GetCloudPolicyManagerForProfile(profile);
81 if (cloud_provider) {
82 return cloud_provider;
83 }
84 return GetInstance()->GetActiveDirectoryPolicyManagerForProfile(profile);
85 }
86
87 // static
73 UserCloudPolicyManagerChromeOS* 88 UserCloudPolicyManagerChromeOS*
74 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( 89 UserCloudPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile(
75 Profile* profile) { 90 Profile* profile) {
76 return GetInstance()->GetManagerForProfile(profile); 91 return GetInstance()->GetCloudPolicyManager(profile);
77 } 92 }
78 93
79 // static 94 // static
80 std::unique_ptr<UserCloudPolicyManagerChromeOS> 95 UserActiveDirectoryPolicyManager* UserCloudPolicyManagerFactoryChromeOS::
96 GetActiveDirectoryPolicyManagerForProfile(Profile* profile) {
97 return GetInstance()->GetActiveDirectoryPolicyManager(profile);
98 }
99
100 // static
101 std::unique_ptr<ConfigurationPolicyProvider>
81 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( 102 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile(
82 Profile* profile, 103 Profile* profile,
83 bool force_immediate_load, 104 bool force_immediate_load,
84 scoped_refptr<base::SequencedTaskRunner> background_task_runner) { 105 scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
85 return GetInstance()->CreateManagerForProfile( 106 return GetInstance()->CreateManagerForProfile(
86 profile, force_immediate_load, background_task_runner); 107 profile, force_immediate_load, background_task_runner);
87 } 108 }
88 109
89 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() 110 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS()
90 : BrowserContextKeyedBaseFactory( 111 : BrowserContextKeyedBaseFactory(
91 "UserCloudPolicyManagerChromeOS", 112 "UserCloudPolicyManagerChromeOS",
92 BrowserContextDependencyManager::GetInstance()) { 113 BrowserContextDependencyManager::GetInstance()) {
93 DependsOn(SchemaRegistryServiceFactory::GetInstance()); 114 DependsOn(SchemaRegistryServiceFactory::GetInstance());
94 } 115 }
95 116
96 UserCloudPolicyManagerFactoryChromeOS:: 117 UserCloudPolicyManagerFactoryChromeOS::
97 ~UserCloudPolicyManagerFactoryChromeOS() {} 118 ~UserCloudPolicyManagerFactoryChromeOS() {}
98 119
99 UserCloudPolicyManagerChromeOS* 120 UserCloudPolicyManagerChromeOS*
100 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( 121 UserCloudPolicyManagerFactoryChromeOS::GetCloudPolicyManager(Profile* profile) {
101 Profile* profile) {
102 // Get the manager for the original profile, since the PolicyService is 122 // Get the manager for the original profile, since the PolicyService is
103 // also shared between the incognito Profile and the original Profile. 123 // also shared between the incognito Profile and the original Profile.
104 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); 124 auto const it = cloud_managers_.find(profile->GetOriginalProfile());
emaxx 2016/12/28 19:09:19 nit: The existing code in this file uses the style
Thiemo Nagel 2016/12/29 15:08:27 Done.
105 return it != managers_.end() ? it->second : NULL; 125 return it != cloud_managers_.end() ? it->second : nullptr;
106 } 126 }
107 127
108 std::unique_ptr<UserCloudPolicyManagerChromeOS> 128 UserActiveDirectoryPolicyManager*
129 UserCloudPolicyManagerFactoryChromeOS::GetActiveDirectoryPolicyManager(
130 Profile* profile) {
131 // Get the manager for the original profile, since the PolicyService is
132 // also shared between the incognito Profile and the original Profile.
133 auto const it =
134 active_directory_managers_.find(profile->GetOriginalProfile());
135 return it != active_directory_managers_.end() ? it->second : nullptr;
136 }
137
138 std::unique_ptr<ConfigurationPolicyProvider>
109 UserCloudPolicyManagerFactoryChromeOS::CreateManagerForProfile( 139 UserCloudPolicyManagerFactoryChromeOS::CreateManagerForProfile(
110 Profile* profile, 140 Profile* profile,
111 bool force_immediate_load, 141 bool force_immediate_load,
112 scoped_refptr<base::SequencedTaskRunner> background_task_runner) { 142 scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
113 const base::CommandLine* command_line = 143 const base::CommandLine* command_line =
114 base::CommandLine::ForCurrentProcess(); 144 base::CommandLine::ForCurrentProcess();
115 // Don't initialize cloud policy for the signin profile. 145 // Don't initialize cloud policy for the signin profile.
116 if (chromeos::ProfileHelper::IsSigninProfile(profile)) 146 if (chromeos::ProfileHelper::IsSigninProfile(profile))
117 return std::unique_ptr<UserCloudPolicyManagerChromeOS>(); 147 return std::unique_ptr<ConfigurationPolicyProvider>();
118 148
119 // |user| should never be NULL except for the signin profile. This object is 149 // |user| should never be nullptr except for the signin profile. This object
120 // created as part of the Profile creation, which happens right after 150 // is created as part of the Profile creation, which happens right after
121 // sign-in. The just-signed-in User is the active user during that time. 151 // sign-in. The just-signed-in User is the active user during that time.
122 const user_manager::User* user = 152 const user_manager::User* user =
123 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 153 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
124 CHECK(user); 154 CHECK(user);
125 155
126 // User policy exists for enterprise accounts only: 156 // User policy exists for enterprise accounts only:
127 // - For regular enterprise users (those who have a GAIA account), a 157 // - For regular cloud-managed users (those who have a GAIA account), a
128 // |UserCloudPolicyManagerChromeOS| is created here. 158 // |UserCloudPolicyManagerChromeOS| is created here.
159 // - For Active Directory managed users, a |UserActiveDirectoryPolicyManager|
160 // is created.
129 // - For device-local accounts, policy is provided by 161 // - For device-local accounts, policy is provided by
130 // |DeviceLocalAccountPolicyService|. 162 // |DeviceLocalAccountPolicyService|.
131 // All other user types do not have user policy. 163 // All other user types do not have user policy.
132 const AccountId account_id = user->GetAccountId(); 164 const AccountId& account_id = user->GetAccountId();
133 if (!user->HasGaiaAccount() || user->IsSupervised() || 165 if (user->IsSupervised() ||
134 BrowserPolicyConnector::IsNonEnterpriseUser(account_id.GetUserEmail())) { 166 BrowserPolicyConnector::IsNonEnterpriseUser(account_id.GetUserEmail())) {
135 return std::unique_ptr<UserCloudPolicyManagerChromeOS>(); 167 return std::unique_ptr<ConfigurationPolicyProvider>();
136 } 168 }
137 169
138 policy::BrowserPolicyConnectorChromeOS* connector = 170 policy::BrowserPolicyConnectorChromeOS* connector =
139 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 171 g_browser_process->platform_part()->browser_policy_connector_chromeos();
172 bool is_active_directory;
emaxx 2016/12/28 19:09:19 nit: I think usually in Chrome source code it's pr
Thiemo Nagel 2016/12/29 15:08:27 Thanks, that seems prudent. I'd assume that the c
173 switch (account_id.GetAccountType()) {
174 case AccountType::UNKNOWN:
175 return std::unique_ptr<ConfigurationPolicyProvider>();
emaxx 2016/12/28 19:09:19 nit: Not insisting, but C++11 allows to shorten th
Thiemo Nagel 2016/12/29 15:08:27 Very interesting, thanks. Done.
176 break;
emaxx 2016/12/28 19:09:19 nit: May be removed.
Thiemo Nagel 2016/12/29 15:08:27 If you don't mind, I'd suggest to keep it for symm
177 case AccountType::GOOGLE:
178 if (!user->HasGaiaAccount()) {
179 return std::unique_ptr<ConfigurationPolicyProvider>();
180 }
181 is_active_directory = false;
182 break;
183 case AccountType::ACTIVE_DIRECTORY:
184 // Ensure install attributes are locked into Active Directory mode before
185 // allowing Active Directory policy which is not signed.
186 if (!connector->GetInstallAttributes()->IsActiveDirectoryManaged()) {
187 return std::unique_ptr<ConfigurationPolicyProvider>();
188 }
189 is_active_directory = true;
190 break;
191 }
192
140 const bool is_browser_restart = 193 const bool is_browser_restart =
141 command_line->HasSwitch(chromeos::switches::kLoginUser); 194 command_line->HasSwitch(chromeos::switches::kLoginUser);
142 const user_manager::UserManager* const user_manager = 195 const user_manager::UserManager* const user_manager =
143 user_manager::UserManager::Get(); 196 user_manager::UserManager::Get();
144 197
145 // We want to block for policy in a few situations: if the user is new, or 198 // We want to block for policy in a few situations: if the user is new, or if
146 // if we are forcing an online signin. An online signin will be forced if 199 // we are forcing an online signin. An online signin will be forced if there
147 // there has been a credential error, or if the initial session creation 200 // has been a credential error, or if the initial session creation was not
148 // was not completed (the oauth_token_status is not set to valid by 201 // completed (the oauth_token_status is not set to valid by OAuth2LoginManager
149 // OAuth2LoginManager until profile creation/session restore is complete). 202 // until profile creation/session restore is complete).
203 // TODO(tnagel): Don't limit blocking to cloud managed users.
150 const bool block_forever_for_policy = 204 const bool block_forever_for_policy =
151 !user_manager->IsLoggedInAsStub() && 205 !is_active_directory && !user_manager->IsLoggedInAsStub() &&
152 (user_manager->IsCurrentUserNew() || 206 (user_manager->IsCurrentUserNew() ||
153 user_manager->GetActiveUser()->force_online_signin() || 207 user_manager->GetActiveUser()->force_online_signin() ||
154 user_manager->GetActiveUser()->oauth_token_status() != 208 user_manager->GetActiveUser()->oauth_token_status() !=
155 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 209 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
156 210
157 const bool wait_for_policy_fetch = 211 const bool wait_for_policy_fetch =
158 block_forever_for_policy || !is_browser_restart; 212 block_forever_for_policy || !is_browser_restart;
159 213
160 base::TimeDelta initial_policy_fetch_timeout; 214 base::TimeDelta initial_policy_fetch_timeout;
161 if (block_forever_for_policy) { 215 if (block_forever_for_policy) {
(...skipping 10 matching lines...) Expand all
172 226
173 base::FilePath profile_dir = profile->GetPath(); 227 base::FilePath profile_dir = profile->GetPath();
174 const base::FilePath component_policy_cache_dir = 228 const base::FilePath component_policy_cache_dir =
175 profile_dir.Append(kPolicy).Append(kComponentsDir); 229 profile_dir.Append(kPolicy).Append(kComponentsDir);
176 const base::FilePath external_data_dir = 230 const base::FilePath external_data_dir =
177 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir); 231 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir);
178 base::FilePath policy_key_dir; 232 base::FilePath policy_key_dir;
179 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir)); 233 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir));
180 234
181 std::unique_ptr<UserCloudPolicyStoreChromeOS> store( 235 std::unique_ptr<UserCloudPolicyStoreChromeOS> store(
182 new UserCloudPolicyStoreChromeOS( 236 new UserCloudPolicyStoreChromeOS(
emaxx 2016/12/28 19:09:19 nit: Use base::MakeUnique here too while you're he
Thiemo Nagel 2016/12/29 15:08:27 Done.
183 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), 237 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(),
184 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), 238 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
185 background_task_runner, account_id, policy_key_dir)); 239 background_task_runner, account_id, policy_key_dir,
240 is_active_directory));
186 241
187 scoped_refptr<base::SequencedTaskRunner> backend_task_runner = 242 scoped_refptr<base::SequencedTaskRunner> backend_task_runner =
188 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 243 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
189 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 244 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
190 scoped_refptr<base::SequencedTaskRunner> io_task_runner = 245 scoped_refptr<base::SequencedTaskRunner> io_task_runner =
191 content::BrowserThread::GetTaskRunnerForThread( 246 content::BrowserThread::GetTaskRunnerForThread(
192 content::BrowserThread::IO); 247 content::BrowserThread::IO);
193 std::unique_ptr<CloudExternalDataManager> external_data_manager( 248 std::unique_ptr<CloudExternalDataManager> external_data_manager(
194 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails), 249 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails),
195 backend_task_runner, io_task_runner, 250 backend_task_runner, io_task_runner,
196 external_data_dir, store.get())); 251 external_data_dir, store.get()));
197 if (force_immediate_load) 252 if (force_immediate_load)
198 store->LoadImmediately(); 253 store->LoadImmediately();
199 254
200 scoped_refptr<base::SequencedTaskRunner> file_task_runner = 255 scoped_refptr<base::SequencedTaskRunner> file_task_runner =
201 content::BrowserThread::GetTaskRunnerForThread( 256 content::BrowserThread::GetTaskRunnerForThread(
202 content::BrowserThread::FILE); 257 content::BrowserThread::FILE);
203 258
204 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager( 259 if (is_active_directory) {
205 new UserCloudPolicyManagerChromeOS( 260 std::unique_ptr<UserActiveDirectoryPolicyManager> manager =
206 std::move(store), std::move(external_data_manager), 261 base::MakeUnique<UserActiveDirectoryPolicyManager>(account_id,
207 component_policy_cache_dir, wait_for_policy_fetch, 262 std::move(store));
208 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(), 263 manager->Init(
209 file_task_runner, io_task_runner)); 264 SchemaRegistryServiceFactory::GetForContext(profile)->registry());
210 265
211 bool wildcard_match = false; 266 DCHECK(cloud_managers_.find(profile) == cloud_managers_.end());
212 if (connector->IsEnterpriseManaged() && 267 DCHECK(active_directory_managers_.find(profile) ==
213 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(), 268 active_directory_managers_.end());
214 &wildcard_match) && 269 active_directory_managers_[profile] = manager.get();
215 wildcard_match && 270 return manager;
216 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) { 271 } else {
217 manager->EnableWildcardLoginCheck(account_id.GetUserEmail()); 272 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager =
273 base::MakeUnique<UserCloudPolicyManagerChromeOS>(
274 std::move(store), std::move(external_data_manager),
275 component_policy_cache_dir, wait_for_policy_fetch,
276 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(),
277 file_task_runner, io_task_runner);
278
279 // TODO(tnagel): Enable whitelist for Active Directory.
280 bool wildcard_match = false;
281 if (connector->IsEnterpriseManaged() &&
282 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(),
283 &wildcard_match) &&
284 wildcard_match &&
285 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) {
286 manager->EnableWildcardLoginCheck(account_id.GetUserEmail());
287 }
288
289 manager->Init(
290 SchemaRegistryServiceFactory::GetForContext(profile)->registry());
291 manager->Connect(g_browser_process->local_state(),
292 device_management_service,
293 g_browser_process->system_request_context());
294
295 DCHECK(cloud_managers_.find(profile) == cloud_managers_.end());
emaxx 2016/12/28 19:09:19 You could move these two DCHECKS out of the condit
Thiemo Nagel 2016/12/29 15:08:27 Good point, they look much better at the top of th
296 DCHECK(active_directory_managers_.find(profile) ==
297 active_directory_managers_.end());
298 cloud_managers_[profile] = manager.get();
299 return manager;
218 } 300 }
219
220 manager->Init(
221 SchemaRegistryServiceFactory::GetForContext(profile)->registry());
222 manager->Connect(g_browser_process->local_state(), device_management_service,
223 g_browser_process->system_request_context());
224
225 DCHECK(managers_.find(profile) == managers_.end());
226 managers_[profile] = manager.get();
227 return manager;
228 } 301 }
229 302
230 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( 303 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown(
231 content::BrowserContext* context) { 304 content::BrowserContext* context) {
232 Profile* profile = static_cast<Profile*>(context); 305 Profile* profile = static_cast<Profile*>(context);
233 if (profile->IsOffTheRecord()) 306 if (profile->IsOffTheRecord())
234 return; 307 return;
235 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); 308 UserCloudPolicyManagerChromeOS* cloud_manager =
236 if (manager) 309 GetCloudPolicyManager(profile);
237 manager->Shutdown(); 310 if (cloud_manager)
311 cloud_manager->Shutdown();
312 UserActiveDirectoryPolicyManager* active_directory_manager =
313 GetActiveDirectoryPolicyManager(profile);
314 if (active_directory_manager)
315 active_directory_manager->Shutdown();
238 } 316 }
239 317
240 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed( 318 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed(
241 content::BrowserContext* context) { 319 content::BrowserContext* context) {
242 Profile* profile = static_cast<Profile*>(context); 320 Profile* profile = static_cast<Profile*>(context);
243 managers_.erase(profile); 321 cloud_managers_.erase(profile);
322 active_directory_managers_.erase(profile);
244 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); 323 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
245 } 324 }
246 325
247 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( 326 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory(
248 content::BrowserContext* context) {} 327 content::BrowserContext* context) {}
249 328
250 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( 329 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory(
251 content::BrowserContext* context) { 330 content::BrowserContext* context) {
252 return false; 331 return false;
253 } 332 }
254 333
255 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( 334 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow(
256 content::BrowserContext* context) {} 335 content::BrowserContext* context) {}
257 336
258 } // namespace policy 337 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698