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

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

Issue 2606773002: Setup Chromad user policy plumbing (Closed)
Patch Set: Rebase 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_policy_manager_factory_chromeos.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 11 matching lines...) Expand all
57 const base::FilePath::CharType kPolicyExternalDataDir[] = 61 const base::FilePath::CharType kPolicyExternalDataDir[] =
58 FILE_PATH_LITERAL("External Data"); 62 FILE_PATH_LITERAL("External Data");
59 63
60 // Timeout in seconds after which to abandon the initial policy fetch and start 64 // Timeout in seconds after which to abandon the initial policy fetch and start
61 // the session regardless. 65 // the session regardless.
62 const int kInitialPolicyFetchTimeoutSeconds = 10; 66 const int kInitialPolicyFetchTimeoutSeconds = 10;
63 67
64 } // namespace 68 } // namespace
65 69
66 // static 70 // static
67 UserCloudPolicyManagerFactoryChromeOS* 71 UserPolicyManagerFactoryChromeOS*
68 UserCloudPolicyManagerFactoryChromeOS::GetInstance() { 72 UserPolicyManagerFactoryChromeOS::GetInstance() {
69 return base::Singleton<UserCloudPolicyManagerFactoryChromeOS>::get(); 73 return base::Singleton<UserPolicyManagerFactoryChromeOS>::get();
74 }
75
76 // static
77 ConfigurationPolicyProvider* UserPolicyManagerFactoryChromeOS::GetForProfile(
78 Profile* profile) {
79 ConfigurationPolicyProvider* cloud_provider =
80 GetInstance()->GetCloudPolicyManagerForProfile(profile);
81 if (cloud_provider) {
82 return cloud_provider;
83 }
84 return GetInstance()->GetActiveDirectoryPolicyManagerForProfile(profile);
70 } 85 }
71 86
72 // static 87 // static
73 UserCloudPolicyManagerChromeOS* 88 UserCloudPolicyManagerChromeOS*
74 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( 89 UserPolicyManagerFactoryChromeOS::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*
81 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( 96 UserPolicyManagerFactoryChromeOS::GetActiveDirectoryPolicyManagerForProfile(
97 Profile* profile) {
98 return GetInstance()->GetActiveDirectoryPolicyManager(profile);
99 }
100
101 // static
102 std::unique_ptr<ConfigurationPolicyProvider>
103 UserPolicyManagerFactoryChromeOS::CreateForProfile(
82 Profile* profile, 104 Profile* profile,
83 bool force_immediate_load, 105 bool force_immediate_load,
84 scoped_refptr<base::SequencedTaskRunner> background_task_runner) { 106 scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
85 return GetInstance()->CreateManagerForProfile( 107 return GetInstance()->CreateManagerForProfile(profile, force_immediate_load,
86 profile, force_immediate_load, background_task_runner); 108 background_task_runner);
87 } 109 }
88 110
89 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() 111 UserPolicyManagerFactoryChromeOS::UserPolicyManagerFactoryChromeOS()
90 : BrowserContextKeyedBaseFactory( 112 : BrowserContextKeyedBaseFactory(
91 "UserCloudPolicyManagerChromeOS", 113 "UserCloudPolicyManagerChromeOS",
92 BrowserContextDependencyManager::GetInstance()) { 114 BrowserContextDependencyManager::GetInstance()) {
93 DependsOn(SchemaRegistryServiceFactory::GetInstance()); 115 DependsOn(SchemaRegistryServiceFactory::GetInstance());
94 } 116 }
95 117
96 UserCloudPolicyManagerFactoryChromeOS:: 118 UserPolicyManagerFactoryChromeOS::~UserPolicyManagerFactoryChromeOS() {}
97 ~UserCloudPolicyManagerFactoryChromeOS() {}
98 119
99 UserCloudPolicyManagerChromeOS* 120 UserCloudPolicyManagerChromeOS*
100 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( 121 UserPolicyManagerFactoryChromeOS::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 const auto it = cloud_managers_.find(profile->GetOriginalProfile());
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*
109 UserCloudPolicyManagerFactoryChromeOS::CreateManagerForProfile( 129 UserPolicyManagerFactoryChromeOS::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 const auto 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>
139 UserPolicyManagerFactoryChromeOS::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) {
143 DCHECK(cloud_managers_.find(profile) == cloud_managers_.end());
144 DCHECK(active_directory_managers_.find(profile) ==
145 active_directory_managers_.end());
146
113 const base::CommandLine* command_line = 147 const base::CommandLine* command_line =
114 base::CommandLine::ForCurrentProcess(); 148 base::CommandLine::ForCurrentProcess();
115 // Don't initialize cloud policy for the signin profile. 149 // Don't initialize cloud policy for the signin profile.
116 if (chromeos::ProfileHelper::IsSigninProfile(profile)) 150 if (chromeos::ProfileHelper::IsSigninProfile(profile))
117 return std::unique_ptr<UserCloudPolicyManagerChromeOS>(); 151 return {};
118 152
119 // |user| should never be NULL except for the signin profile. This object is 153 // |user| should never be nullptr except for the signin profile. This object
120 // created as part of the Profile creation, which happens right after 154 // 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. 155 // sign-in. The just-signed-in User is the active user during that time.
122 const user_manager::User* user = 156 const user_manager::User* user =
123 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); 157 chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
124 CHECK(user); 158 CHECK(user);
125 159
126 // User policy exists for enterprise accounts only: 160 // User policy exists for enterprise accounts only:
127 // - For regular enterprise users (those who have a GAIA account), a 161 // - For regular cloud-managed users (those who have a GAIA account), a
128 // |UserCloudPolicyManagerChromeOS| is created here. 162 // |UserCloudPolicyManagerChromeOS| is created here.
163 // - For Active Directory managed users, a |UserActiveDirectoryPolicyManager|
164 // is created.
129 // - For device-local accounts, policy is provided by 165 // - For device-local accounts, policy is provided by
130 // |DeviceLocalAccountPolicyService|. 166 // |DeviceLocalAccountPolicyService|.
131 // All other user types do not have user policy. 167 // All other user types do not have user policy.
132 const AccountId account_id = user->GetAccountId(); 168 const AccountId& account_id = user->GetAccountId();
133 if (!user->HasGaiaAccount() || user->IsSupervised() || 169 if (user->IsSupervised() ||
134 BrowserPolicyConnector::IsNonEnterpriseUser(account_id.GetUserEmail())) { 170 BrowserPolicyConnector::IsNonEnterpriseUser(account_id.GetUserEmail())) {
135 return std::unique_ptr<UserCloudPolicyManagerChromeOS>(); 171 return {};
136 } 172 }
137 173
138 policy::BrowserPolicyConnectorChromeOS* connector = 174 policy::BrowserPolicyConnectorChromeOS* connector =
139 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 175 g_browser_process->platform_part()->browser_policy_connector_chromeos();
176 bool is_active_directory = false;
177 switch (account_id.GetAccountType()) {
178 case AccountType::UNKNOWN:
179 case AccountType::GOOGLE:
180 // TODO(tnagel): Return nullptr for unknown accounts once AccountId
181 // migration is finished.
182 if (!user->HasGaiaAccount()) {
183 return {};
184 }
185 is_active_directory = false;
186 break;
187 case AccountType::ACTIVE_DIRECTORY:
188 // Ensure install attributes are locked into Active Directory mode before
189 // allowing Active Directory policy which is not signed.
190 if (!connector->GetInstallAttributes()->IsActiveDirectoryManaged()) {
191 return {};
192 }
193 is_active_directory = true;
194 break;
195 }
196
140 const bool is_browser_restart = 197 const bool is_browser_restart =
141 command_line->HasSwitch(chromeos::switches::kLoginUser); 198 command_line->HasSwitch(chromeos::switches::kLoginUser);
142 const user_manager::UserManager* const user_manager = 199 const user_manager::UserManager* const user_manager =
143 user_manager::UserManager::Get(); 200 user_manager::UserManager::Get();
144 201
145 // We want to block for policy in a few situations: if the user is new, or 202 // 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 203 // 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 204 // 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 205 // completed (the oauth_token_status is not set to valid by OAuth2LoginManager
149 // OAuth2LoginManager until profile creation/session restore is complete). 206 // until profile creation/session restore is complete).
207 // TODO(tnagel): Don't limit blocking to cloud managed users.
150 const bool block_forever_for_policy = 208 const bool block_forever_for_policy =
151 !user_manager->IsLoggedInAsStub() && 209 !is_active_directory && !user_manager->IsLoggedInAsStub() &&
152 (user_manager->IsCurrentUserNew() || 210 (user_manager->IsCurrentUserNew() ||
153 user_manager->GetActiveUser()->force_online_signin() || 211 user_manager->GetActiveUser()->force_online_signin() ||
154 user_manager->GetActiveUser()->oauth_token_status() != 212 user_manager->GetActiveUser()->oauth_token_status() !=
155 user_manager::User::OAUTH2_TOKEN_STATUS_VALID); 213 user_manager::User::OAUTH2_TOKEN_STATUS_VALID);
156 214
157 const bool wait_for_policy_fetch = 215 const bool wait_for_policy_fetch =
158 block_forever_for_policy || !is_browser_restart; 216 block_forever_for_policy || !is_browser_restart;
159 217
160 base::TimeDelta initial_policy_fetch_timeout; 218 base::TimeDelta initial_policy_fetch_timeout;
161 if (block_forever_for_policy) { 219 if (block_forever_for_policy) {
162 initial_policy_fetch_timeout = base::TimeDelta::Max(); 220 initial_policy_fetch_timeout = base::TimeDelta::Max();
163 } else if (wait_for_policy_fetch) { 221 } else if (wait_for_policy_fetch) {
164 initial_policy_fetch_timeout = 222 initial_policy_fetch_timeout =
165 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds); 223 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds);
166 } 224 }
167 225
168 DeviceManagementService* device_management_service = 226 DeviceManagementService* device_management_service =
169 connector->device_management_service(); 227 connector->device_management_service();
170 if (wait_for_policy_fetch) 228 if (wait_for_policy_fetch)
171 device_management_service->ScheduleInitialization(0); 229 device_management_service->ScheduleInitialization(0);
172 230
173 base::FilePath profile_dir = profile->GetPath(); 231 base::FilePath profile_dir = profile->GetPath();
174 const base::FilePath component_policy_cache_dir = 232 const base::FilePath component_policy_cache_dir =
175 profile_dir.Append(kPolicy).Append(kComponentsDir); 233 profile_dir.Append(kPolicy).Append(kComponentsDir);
176 const base::FilePath external_data_dir = 234 const base::FilePath external_data_dir =
177 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir); 235 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir);
178 base::FilePath policy_key_dir; 236 base::FilePath policy_key_dir;
179 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir)); 237 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir));
180 238
181 std::unique_ptr<UserCloudPolicyStoreChromeOS> store( 239 std::unique_ptr<UserCloudPolicyStoreChromeOS> store =
182 new UserCloudPolicyStoreChromeOS( 240 base::MakeUnique<UserCloudPolicyStoreChromeOS>(
183 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), 241 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(),
184 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), 242 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
185 background_task_runner, account_id, policy_key_dir)); 243 background_task_runner, account_id, policy_key_dir,
244 is_active_directory);
186 245
187 scoped_refptr<base::SequencedTaskRunner> backend_task_runner = 246 scoped_refptr<base::SequencedTaskRunner> backend_task_runner =
188 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 247 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
189 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 248 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
190 scoped_refptr<base::SequencedTaskRunner> io_task_runner = 249 scoped_refptr<base::SequencedTaskRunner> io_task_runner =
191 content::BrowserThread::GetTaskRunnerForThread( 250 content::BrowserThread::GetTaskRunnerForThread(
192 content::BrowserThread::IO); 251 content::BrowserThread::IO);
193 std::unique_ptr<CloudExternalDataManager> external_data_manager( 252 std::unique_ptr<CloudExternalDataManager> external_data_manager(
194 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails), 253 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails),
195 backend_task_runner, io_task_runner, 254 backend_task_runner, io_task_runner,
196 external_data_dir, store.get())); 255 external_data_dir, store.get()));
197 if (force_immediate_load) 256 if (force_immediate_load)
198 store->LoadImmediately(); 257 store->LoadImmediately();
199 258
200 scoped_refptr<base::SequencedTaskRunner> file_task_runner = 259 scoped_refptr<base::SequencedTaskRunner> file_task_runner =
201 content::BrowserThread::GetTaskRunnerForThread( 260 content::BrowserThread::GetTaskRunnerForThread(
202 content::BrowserThread::FILE); 261 content::BrowserThread::FILE);
203 262
204 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager( 263 if (is_active_directory) {
205 new UserCloudPolicyManagerChromeOS( 264 std::unique_ptr<UserActiveDirectoryPolicyManager> manager =
206 std::move(store), std::move(external_data_manager), 265 base::MakeUnique<UserActiveDirectoryPolicyManager>(account_id,
207 component_policy_cache_dir, wait_for_policy_fetch, 266 std::move(store));
208 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(), 267 manager->Init(
209 file_task_runner, io_task_runner)); 268 SchemaRegistryServiceFactory::GetForContext(profile)->registry());
210 269
211 bool wildcard_match = false; 270 active_directory_managers_[profile] = manager.get();
212 if (connector->IsEnterpriseManaged() && 271 return std::move(manager);
213 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(), 272 } else {
214 &wildcard_match) && 273 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager =
215 wildcard_match && 274 base::MakeUnique<UserCloudPolicyManagerChromeOS>(
216 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) { 275 std::move(store), std::move(external_data_manager),
217 manager->EnableWildcardLoginCheck(account_id.GetUserEmail()); 276 component_policy_cache_dir, wait_for_policy_fetch,
277 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(),
278 file_task_runner, io_task_runner);
279
280 // TODO(tnagel): Enable whitelist for Active Directory.
281 bool wildcard_match = false;
282 if (connector->IsEnterpriseManaged() &&
283 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(),
284 &wildcard_match) &&
285 wildcard_match &&
286 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) {
287 manager->EnableWildcardLoginCheck(account_id.GetUserEmail());
288 }
289
290 manager->Init(
291 SchemaRegistryServiceFactory::GetForContext(profile)->registry());
292 manager->Connect(g_browser_process->local_state(),
293 device_management_service,
294 g_browser_process->system_request_context());
295
296 cloud_managers_[profile] = manager.get();
297 return std::move(manager);
218 } 298 }
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 } 299 }
229 300
230 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( 301 void UserPolicyManagerFactoryChromeOS::BrowserContextShutdown(
231 content::BrowserContext* context) { 302 content::BrowserContext* context) {
232 Profile* profile = static_cast<Profile*>(context); 303 Profile* profile = static_cast<Profile*>(context);
233 if (profile->IsOffTheRecord()) 304 if (profile->IsOffTheRecord())
234 return; 305 return;
235 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); 306 UserCloudPolicyManagerChromeOS* cloud_manager =
236 if (manager) 307 GetCloudPolicyManager(profile);
237 manager->Shutdown(); 308 if (cloud_manager)
309 cloud_manager->Shutdown();
310 UserActiveDirectoryPolicyManager* active_directory_manager =
311 GetActiveDirectoryPolicyManager(profile);
312 if (active_directory_manager)
313 active_directory_manager->Shutdown();
238 } 314 }
239 315
240 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed( 316 void UserPolicyManagerFactoryChromeOS::BrowserContextDestroyed(
241 content::BrowserContext* context) { 317 content::BrowserContext* context) {
242 Profile* profile = static_cast<Profile*>(context); 318 Profile* profile = static_cast<Profile*>(context);
243 managers_.erase(profile); 319 cloud_managers_.erase(profile);
320 active_directory_managers_.erase(profile);
244 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); 321 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
245 } 322 }
246 323
247 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( 324 void UserPolicyManagerFactoryChromeOS::SetEmptyTestingFactory(
248 content::BrowserContext* context) {} 325 content::BrowserContext* context) {}
249 326
250 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( 327 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory(
251 content::BrowserContext* context) { 328 content::BrowserContext* context) {
252 return false; 329 return false;
253 } 330 }
254 331
255 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( 332 void UserPolicyManagerFactoryChromeOS::CreateServiceNow(
256 content::BrowserContext* context) {} 333 content::BrowserContext* context) {}
257 334
258 } // namespace policy 335 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698