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_policy_manager_factory_chromeos.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/ptr_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
17 #include "base/task_scheduler/post_task.h" | 17 #include "base/task_scheduler/post_task.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chromeos/policy/active_directory_policy_manager.h" | 21 #include "chrome/browser/chromeos/policy/active_directory_policy_manager.h" |
22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
23 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" | 23 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" |
24 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 24 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
25 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" | 25 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
26 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
27 #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" | 28 #include "chrome/browser/chromeos/settings/install_attributes.h" |
| 29 #include "chrome/browser/lifetime/application_lifetime.h" |
29 #include "chrome/browser/policy/schema_registry_service.h" | 30 #include "chrome/browser/policy/schema_registry_service.h" |
30 #include "chrome/browser/policy/schema_registry_service_factory.h" | 31 #include "chrome/browser/policy/schema_registry_service_factory.h" |
31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
32 #include "chromeos/chromeos_paths.h" | 33 #include "chromeos/chromeos_paths.h" |
33 #include "chromeos/chromeos_switches.h" | 34 #include "chromeos/chromeos_switches.h" |
34 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
35 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 36 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
36 #include "components/policy/core/browser/browser_policy_connector.h" | 37 #include "components/policy/core/browser/browser_policy_connector.h" |
37 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 38 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
38 #include "components/policy/core/common/cloud/device_management_service.h" | 39 #include "components/policy/core/common/cloud/device_management_service.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 external_data_dir, store.get())); | 255 external_data_dir, store.get())); |
255 if (force_immediate_load) | 256 if (force_immediate_load) |
256 store->LoadImmediately(); | 257 store->LoadImmediately(); |
257 | 258 |
258 scoped_refptr<base::SequencedTaskRunner> file_task_runner = | 259 scoped_refptr<base::SequencedTaskRunner> file_task_runner = |
259 content::BrowserThread::GetTaskRunnerForThread( | 260 content::BrowserThread::GetTaskRunnerForThread( |
260 content::BrowserThread::FILE); | 261 content::BrowserThread::FILE); |
261 | 262 |
262 if (is_active_directory) { | 263 if (is_active_directory) { |
263 std::unique_ptr<ActiveDirectoryPolicyManager> manager = | 264 std::unique_ptr<ActiveDirectoryPolicyManager> manager = |
264 ActiveDirectoryPolicyManager::CreateForUserPolicy(account_id, | 265 ActiveDirectoryPolicyManager::CreateForUserPolicy( |
265 std::move(store)); | 266 account_id, initial_policy_fetch_timeout, |
| 267 base::BindOnce(&chrome::AttemptUserExit), std::move(store)); |
266 manager->Init( | 268 manager->Init( |
267 SchemaRegistryServiceFactory::GetForContext(profile)->registry()); | 269 SchemaRegistryServiceFactory::GetForContext(profile)->registry()); |
268 | 270 |
269 active_directory_managers_[profile] = manager.get(); | 271 active_directory_managers_[profile] = manager.get(); |
270 return std::move(manager); | 272 return std::move(manager); |
271 } else { | 273 } else { |
272 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager = | 274 std::unique_ptr<UserCloudPolicyManagerChromeOS> manager = |
273 base::MakeUnique<UserCloudPolicyManagerChromeOS>( | 275 base::MakeUnique<UserCloudPolicyManagerChromeOS>( |
274 std::move(store), std::move(external_data_manager), | 276 std::move(store), std::move(external_data_manager), |
275 component_policy_cache_dir, wait_for_policy_fetch, | 277 component_policy_cache_dir, initial_policy_fetch_timeout, |
276 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(), | 278 base::ThreadTaskRunnerHandle::Get(), file_task_runner, |
277 file_task_runner, io_task_runner); | 279 io_task_runner); |
278 | 280 |
279 // TODO(tnagel): Enable whitelist for Active Directory. | 281 // TODO(tnagel): Enable whitelist for Active Directory. |
280 bool wildcard_match = false; | 282 bool wildcard_match = false; |
281 if (connector->IsEnterpriseManaged() && | 283 if (connector->IsEnterpriseManaged() && |
282 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(), | 284 chromeos::CrosSettings::IsWhitelisted(account_id.GetUserEmail(), |
283 &wildcard_match) && | 285 &wildcard_match) && |
284 wildcard_match && | 286 wildcard_match && |
285 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) { | 287 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) { |
286 manager->EnableWildcardLoginCheck(account_id.GetUserEmail()); | 288 manager->EnableWildcardLoginCheck(account_id.GetUserEmail()); |
287 } | 289 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 327 |
326 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( | 328 bool UserPolicyManagerFactoryChromeOS::HasTestingFactory( |
327 content::BrowserContext* context) { | 329 content::BrowserContext* context) { |
328 return false; | 330 return false; |
329 } | 331 } |
330 | 332 |
331 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( | 333 void UserPolicyManagerFactoryChromeOS::CreateServiceNow( |
332 content::BrowserContext* context) {} | 334 content::BrowserContext* context) {} |
333 | 335 |
334 } // namespace policy | 336 } // namespace policy |
OLD | NEW |