| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_policy_connector_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/message_loop/message_loop_proxy.h" | |
| 15 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
| 17 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/thread_task_runner_handle.h" |
| 19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "chrome/browser/chromeos/policy/affiliated_cloud_policy_invalidator.h" | 20 #include "chrome/browser/chromeos/policy/affiliated_cloud_policy_invalidator.h" |
| 21 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r.h" | 21 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r.h" |
| 22 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r_impl.h" | 22 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r_impl.h" |
| 23 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 23 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 25 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 25 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 26 #include "chrome/browser/chromeos/policy/device_local_account.h" | 26 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 27 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 27 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 28 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" | 28 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests. | 101 // SystemSaltGetter or DBusThreadManager may be uninitialized on unit tests. |
| 102 | 102 |
| 103 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready | 103 // TODO(satorux): Remove SystemSaltGetter::IsInitialized() when it's ready |
| 104 // (removing it now breaks tests). crbug.com/141016. | 104 // (removing it now breaks tests). crbug.com/141016. |
| 105 if (chromeos::SystemSaltGetter::IsInitialized() && | 105 if (chromeos::SystemSaltGetter::IsInitialized() && |
| 106 chromeos::DBusThreadManager::IsInitialized()) { | 106 chromeos::DBusThreadManager::IsInitialized()) { |
| 107 state_keys_broker_.reset(new ServerBackedStateKeysBroker( | 107 state_keys_broker_.reset(new ServerBackedStateKeysBroker( |
| 108 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 108 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| 109 base::MessageLoopProxy::current())); | 109 base::ThreadTaskRunnerHandle::Get())); |
| 110 | 110 |
| 111 chromeos::CryptohomeClient* cryptohome_client = | 111 chromeos::CryptohomeClient* cryptohome_client = |
| 112 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 112 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
| 113 if (!install_attributes_) { | 113 if (!install_attributes_) { |
| 114 install_attributes_.reset( | 114 install_attributes_.reset( |
| 115 new EnterpriseInstallAttributes(cryptohome_client)); | 115 new EnterpriseInstallAttributes(cryptohome_client)); |
| 116 } | 116 } |
| 117 base::FilePath install_attrs_file; | 117 base::FilePath install_attrs_file; |
| 118 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, | 118 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, |
| 119 &install_attrs_file)); | 119 &install_attrs_file)); |
| 120 install_attributes_->ReadCacheFile(install_attrs_file); | 120 install_attributes_->ReadCacheFile(install_attrs_file); |
| 121 | 121 |
| 122 const base::CommandLine* command_line = | 122 const base::CommandLine* command_line = |
| 123 base::CommandLine::ForCurrentProcess(); | 123 base::CommandLine::ForCurrentProcess(); |
| 124 if (command_line->HasSwitch( | 124 if (command_line->HasSwitch( |
| 125 chromeos::switches::kEnableConsumerManagement)) { | 125 chromeos::switches::kEnableConsumerManagement)) { |
| 126 consumer_management_service_.reset( | 126 consumer_management_service_.reset( |
| 127 new ConsumerManagementService( | 127 new ConsumerManagementService( |
| 128 cryptohome_client, | 128 cryptohome_client, |
| 129 chromeos::DeviceSettingsService::Get())); | 129 chromeos::DeviceSettingsService::Get())); |
| 130 } | 130 } |
| 131 | 131 |
| 132 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 132 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
| 133 new DeviceCloudPolicyStoreChromeOS( | 133 new DeviceCloudPolicyStoreChromeOS( |
| 134 chromeos::DeviceSettingsService::Get(), | 134 chromeos::DeviceSettingsService::Get(), |
| 135 install_attributes_.get(), | 135 install_attributes_.get(), |
| 136 GetBackgroundTaskRunner())); | 136 GetBackgroundTaskRunner())); |
| 137 device_cloud_policy_manager_ = | 137 device_cloud_policy_manager_ = new DeviceCloudPolicyManagerChromeOS( |
| 138 new DeviceCloudPolicyManagerChromeOS(device_cloud_policy_store.Pass(), | 138 device_cloud_policy_store.Pass(), base::ThreadTaskRunnerHandle::Get(), |
| 139 base::MessageLoopProxy::current(), | 139 state_keys_broker_.get()); |
| 140 state_keys_broker_.get()); | |
| 141 AddPolicyProvider( | 140 AddPolicyProvider( |
| 142 scoped_ptr<ConfigurationPolicyProvider>(device_cloud_policy_manager_)); | 141 scoped_ptr<ConfigurationPolicyProvider>(device_cloud_policy_manager_)); |
| 143 } | 142 } |
| 144 | 143 |
| 145 global_user_cloud_policy_provider_ = new ProxyPolicyProvider(); | 144 global_user_cloud_policy_provider_ = new ProxyPolicyProvider(); |
| 146 AddPolicyProvider(scoped_ptr<ConfigurationPolicyProvider>( | 145 AddPolicyProvider(scoped_ptr<ConfigurationPolicyProvider>( |
| 147 global_user_cloud_policy_provider_)); | 146 global_user_cloud_policy_provider_)); |
| 148 } | 147 } |
| 149 | 148 |
| 150 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} | 149 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 consumer_device_management_service_.get(), | 366 consumer_device_management_service_.get(), |
| 368 GetBackgroundTaskRunner(), | 367 GetBackgroundTaskRunner(), |
| 369 install_attributes_.get(), | 368 install_attributes_.get(), |
| 370 state_keys_broker_.get(), | 369 state_keys_broker_.get(), |
| 371 device_cloud_policy_manager_->device_store(), | 370 device_cloud_policy_manager_->device_store(), |
| 372 device_cloud_policy_manager_)); | 371 device_cloud_policy_manager_)); |
| 373 device_cloud_policy_initializer_->Init(); | 372 device_cloud_policy_initializer_->Init(); |
| 374 } | 373 } |
| 375 | 374 |
| 376 } // namespace policy | 375 } // namespace policy |
| OLD | NEW |