| Index: chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
|
| diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
|
| index 20ea73b9fcc256c318b46bcfaaafc578e5ab78e1..761b6531368d33354f464580b85f4d3bcf395604 100644
|
| --- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
|
| +++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
|
| @@ -30,11 +30,11 @@
|
| #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
|
| #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h"
|
| #include "chrome/browser/chromeos/policy/enrollment_config.h"
|
| -#include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
|
| #include "chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.h"
|
| #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chrome/browser/chromeos/settings/device_settings_service.h"
|
| +#include "chrome/browser/chromeos/settings/install_attributes.h"
|
| #include "chrome/browser/policy/device_management_service_configuration.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chromeos/attestation/attestation_flow.h"
|
| @@ -65,7 +65,7 @@ namespace policy {
|
| namespace {
|
|
|
| // Install attributes for tests.
|
| -EnterpriseInstallAttributes* g_testing_install_attributes = nullptr;
|
| +chromeos::InstallAttributes* g_testing_install_attributes = nullptr;
|
|
|
| // Helper that returns a new SequencedTaskRunner backed by the blocking pool.
|
| // Each SequencedTaskRunner returned is independent from the others.
|
| @@ -93,9 +93,9 @@ BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS()
|
| // (removing it now breaks tests). crbug.com/141016.
|
| if (chromeos::SystemSaltGetter::IsInitialized() &&
|
| chromeos::DBusThreadManager::IsInitialized()) {
|
| - state_keys_broker_.reset(new ServerBackedStateKeysBroker(
|
| + state_keys_broker_ = base::MakeUnique<ServerBackedStateKeysBroker>(
|
| chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
|
| - base::ThreadTaskRunnerHandle::Get()));
|
| + base::ThreadTaskRunnerHandle::Get());
|
|
|
| chromeos::CryptohomeClient* cryptohome_client =
|
| chromeos::DBusThreadManager::Get()->GetCryptohomeClient();
|
| @@ -103,18 +103,18 @@ BrowserPolicyConnectorChromeOS::BrowserPolicyConnectorChromeOS()
|
| // Don't initialize install attributes if g_testing_install_attributes have
|
| // been injected.
|
| if (!install_attributes_) {
|
| - install_attributes_.reset(
|
| - new EnterpriseInstallAttributes(cryptohome_client));
|
| + install_attributes_ =
|
| + base::MakeUnique<chromeos::InstallAttributes>(cryptohome_client);
|
| base::FilePath install_attrs_file;
|
| CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES,
|
| &install_attrs_file));
|
| install_attributes_->Init(install_attrs_file);
|
| }
|
|
|
| - std::unique_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store(
|
| - new DeviceCloudPolicyStoreChromeOS(
|
| + std::unique_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store =
|
| + base::MakeUnique<DeviceCloudPolicyStoreChromeOS>(
|
| chromeos::DeviceSettingsService::Get(), install_attributes_.get(),
|
| - GetBackgroundTaskRunner()));
|
| + GetBackgroundTaskRunner());
|
| device_cloud_policy_manager_ = new DeviceCloudPolicyManagerChromeOS(
|
| std::move(device_cloud_policy_store),
|
| base::ThreadTaskRunnerHandle::Get(), state_keys_broker_.get());
|
| @@ -135,8 +135,8 @@ void BrowserPolicyConnectorChromeOS::Init(
|
| local_state_ = local_state;
|
| ChromeBrowserPolicyConnector::Init(local_state, request_context);
|
|
|
| - affiliated_invalidation_service_provider_.reset(
|
| - new AffiliatedInvalidationServiceProviderImpl);
|
| + affiliated_invalidation_service_provider_ =
|
| + base::MakeUnique<AffiliatedInvalidationServiceProviderImpl>();
|
|
|
| if (device_cloud_policy_manager_) {
|
| // Note: for now the |device_cloud_policy_manager_| is using the global
|
| @@ -149,8 +149,8 @@ void BrowserPolicyConnectorChromeOS::Init(
|
| RestartDeviceCloudPolicyInitializer();
|
| }
|
|
|
| - device_local_account_policy_service_.reset(
|
| - new DeviceLocalAccountPolicyService(
|
| + device_local_account_policy_service_ =
|
| + base::MakeUnique<DeviceLocalAccountPolicyService>(
|
| chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
|
| chromeos::DeviceSettingsService::Get(), chromeos::CrosSettings::Get(),
|
| affiliated_invalidation_service_provider_.get(),
|
| @@ -158,17 +158,18 @@ void BrowserPolicyConnectorChromeOS::Init(
|
| GetBackgroundTaskRunner(),
|
| content::BrowserThread::GetTaskRunnerForThread(
|
| content::BrowserThread::IO),
|
| - request_context));
|
| + request_context);
|
| device_local_account_policy_service_->Connect(device_management_service());
|
| if (device_cloud_policy_manager_) {
|
| - device_cloud_policy_invalidator_.reset(new AffiliatedCloudPolicyInvalidator(
|
| - enterprise_management::DeviceRegisterRequest::DEVICE,
|
| - device_cloud_policy_manager_->core(),
|
| - affiliated_invalidation_service_provider_.get()));
|
| - device_remote_commands_invalidator_.reset(
|
| - new AffiliatedRemoteCommandsInvalidator(
|
| + device_cloud_policy_invalidator_ =
|
| + base::MakeUnique<AffiliatedCloudPolicyInvalidator>(
|
| + enterprise_management::DeviceRegisterRequest::DEVICE,
|
| device_cloud_policy_manager_->core(),
|
| - affiliated_invalidation_service_provider_.get()));
|
| + affiliated_invalidation_service_provider_.get());
|
| + device_remote_commands_invalidator_ =
|
| + base::MakeUnique<AffiliatedRemoteCommandsInvalidator>(
|
| + device_cloud_policy_manager_->core(),
|
| + affiliated_invalidation_service_provider_.get());
|
| }
|
|
|
| SetTimezoneIfPolicyAvailable();
|
| @@ -181,8 +182,8 @@ void BrowserPolicyConnectorChromeOS::Init(
|
| chromeos::NetworkHandler::Get()->network_device_handler(),
|
| chromeos::CrosSettings::Get());
|
|
|
| - bluetooth_policy_handler_.reset(
|
| - new BluetoothPolicyHandler(chromeos::CrosSettings::Get()));
|
| + bluetooth_policy_handler_ =
|
| + base::MakeUnique<BluetoothPolicyHandler>(chromeos::CrosSettings::Get());
|
| }
|
|
|
| void BrowserPolicyConnectorChromeOS::PreShutdown() {
|
| @@ -262,7 +263,7 @@ void BrowserPolicyConnectorChromeOS::SetDeviceCloudPolicyInitializerForTesting(
|
|
|
| // static
|
| void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(
|
| - EnterpriseInstallAttributes* attributes) {
|
| + chromeos::InstallAttributes* attributes) {
|
| DCHECK(!g_testing_install_attributes);
|
| g_testing_install_attributes = attributes;
|
| }
|
| @@ -319,12 +320,14 @@ void BrowserPolicyConnectorChromeOS::SetTimezoneIfPolicyAvailable() {
|
| }
|
|
|
| void BrowserPolicyConnectorChromeOS::RestartDeviceCloudPolicyInitializer() {
|
| - device_cloud_policy_initializer_.reset(new DeviceCloudPolicyInitializer(
|
| - local_state_, device_management_service(), GetBackgroundTaskRunner(),
|
| - install_attributes_.get(), state_keys_broker_.get(),
|
| - device_cloud_policy_manager_->device_store(),
|
| - device_cloud_policy_manager_,
|
| - cryptohome::AsyncMethodCaller::GetInstance(), CreateAttestationFlow()));
|
| + device_cloud_policy_initializer_ =
|
| + base::MakeUnique<DeviceCloudPolicyInitializer>(
|
| + local_state_, device_management_service(), GetBackgroundTaskRunner(),
|
| + install_attributes_.get(), state_keys_broker_.get(),
|
| + device_cloud_policy_manager_->device_store(),
|
| + device_cloud_policy_manager_,
|
| + cryptohome::AsyncMethodCaller::GetInstance(),
|
| + CreateAttestationFlow());
|
| device_cloud_policy_initializer_->Init();
|
| }
|
|
|
|
|