| 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/chromeos/login/users/affiliation.h" | 15 #include "chrome/browser/chromeos/login/users/affiliation.h" |
| 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 17 #include "chrome/browser/policy/chrome_browser_policy_connector.h" | 17 #include "chrome/browser/policy/chrome_browser_policy_connector.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 19 | 19 |
| 20 class PrefRegistrySimple; | 20 class PrefRegistrySimple; |
| 21 class PrefService; | 21 class PrefService; |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 ConsumerManagementService* GetConsumerManagementService() const { | 118 ConsumerManagementService* GetConsumerManagementService() const { |
| 119 return consumer_management_service_.get(); | 119 return consumer_management_service_.get(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 DeviceManagementService* GetDeviceManagementServiceForConsumer() const { | 122 DeviceManagementService* GetDeviceManagementServiceForConsumer() const { |
| 123 return consumer_device_management_service_.get(); | 123 return consumer_device_management_service_.get(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Sets the consumer management service for testing. | 126 // Sets the consumer management service for testing. |
| 127 void SetConsumerManagementServiceForTesting( | 127 void SetConsumerManagementServiceForTesting( |
| 128 scoped_ptr<ConsumerManagementService> service); | 128 std::unique_ptr<ConsumerManagementService> service); |
| 129 | 129 |
| 130 // Sets the device cloud policy initializer for testing. | 130 // Sets the device cloud policy initializer for testing. |
| 131 void SetDeviceCloudPolicyInitializerForTesting( | 131 void SetDeviceCloudPolicyInitializerForTesting( |
| 132 scoped_ptr<DeviceCloudPolicyInitializer> initializer); | 132 std::unique_ptr<DeviceCloudPolicyInitializer> initializer); |
| 133 | 133 |
| 134 // Sets the install attributes for testing. Must be called before the browser | 134 // Sets the install attributes for testing. Must be called before the browser |
| 135 // is created. RemoveInstallAttributesForTesting must be called after the test | 135 // is created. RemoveInstallAttributesForTesting must be called after the test |
| 136 // to free the attributes. | 136 // to free the attributes. |
| 137 static void SetInstallAttributesForTesting( | 137 static void SetInstallAttributesForTesting( |
| 138 EnterpriseInstallAttributes* attributes); | 138 EnterpriseInstallAttributes* attributes); |
| 139 static void RemoveInstallAttributesForTesting(); | 139 static void RemoveInstallAttributesForTesting(); |
| 140 | 140 |
| 141 // Registers device refresh rate pref. | 141 // Registers device refresh rate pref. |
| 142 static void RegisterPrefs(PrefRegistrySimple* registry); | 142 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 143 | 143 |
| 144 // DeviceCloudPolicyManagerChromeOS::Observer: | 144 // DeviceCloudPolicyManagerChromeOS::Observer: |
| 145 void OnDeviceCloudPolicyManagerConnected() override; | 145 void OnDeviceCloudPolicyManagerConnected() override; |
| 146 void OnDeviceCloudPolicyManagerDisconnected() override; | 146 void OnDeviceCloudPolicyManagerDisconnected() override; |
| 147 | 147 |
| 148 chromeos::AffiliationIDSet GetDeviceAffiliationIDs() const; | 148 chromeos::AffiliationIDSet GetDeviceAffiliationIDs() const; |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 // Set the timezone as soon as the policies are available. | 151 // Set the timezone as soon as the policies are available. |
| 152 void SetTimezoneIfPolicyAvailable(); | 152 void SetTimezoneIfPolicyAvailable(); |
| 153 | 153 |
| 154 // Restarts the device cloud policy initializer, because the device's | 154 // Restarts the device cloud policy initializer, because the device's |
| 155 // registration status changed from registered to unregistered. | 155 // registration status changed from registered to unregistered. |
| 156 void RestartDeviceCloudPolicyInitializer(); | 156 void RestartDeviceCloudPolicyInitializer(); |
| 157 | 157 |
| 158 // Components of the device cloud policy implementation. | 158 // Components of the device cloud policy implementation. |
| 159 scoped_ptr<ServerBackedStateKeysBroker> state_keys_broker_; | 159 std::unique_ptr<ServerBackedStateKeysBroker> state_keys_broker_; |
| 160 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; | 160 std::unique_ptr<EnterpriseInstallAttributes> install_attributes_; |
| 161 scoped_ptr<AffiliatedInvalidationServiceProvider> | 161 std::unique_ptr<AffiliatedInvalidationServiceProvider> |
| 162 affiliated_invalidation_service_provider_; | 162 affiliated_invalidation_service_provider_; |
| 163 scoped_ptr<ConsumerManagementService> consumer_management_service_; | 163 std::unique_ptr<ConsumerManagementService> consumer_management_service_; |
| 164 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; | 164 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; |
| 165 PrefService* local_state_; | 165 PrefService* local_state_; |
| 166 scoped_ptr<DeviceManagementService> consumer_device_management_service_; | 166 std::unique_ptr<DeviceManagementService> consumer_device_management_service_; |
| 167 scoped_ptr<DeviceCloudPolicyInitializer> device_cloud_policy_initializer_; | 167 std::unique_ptr<DeviceCloudPolicyInitializer> |
| 168 scoped_ptr<DeviceLocalAccountPolicyService> | 168 device_cloud_policy_initializer_; |
| 169 std::unique_ptr<DeviceLocalAccountPolicyService> |
| 169 device_local_account_policy_service_; | 170 device_local_account_policy_service_; |
| 170 scoped_ptr<AffiliatedCloudPolicyInvalidator> device_cloud_policy_invalidator_; | 171 std::unique_ptr<AffiliatedCloudPolicyInvalidator> |
| 171 scoped_ptr<AffiliatedRemoteCommandsInvalidator> | 172 device_cloud_policy_invalidator_; |
| 173 std::unique_ptr<AffiliatedRemoteCommandsInvalidator> |
| 172 device_remote_commands_invalidator_; | 174 device_remote_commands_invalidator_; |
| 173 | 175 |
| 174 // This policy provider is used on Chrome OS to feed user policy into the | 176 // This policy provider is used on Chrome OS to feed user policy into the |
| 175 // global PolicyService instance. This works by installing the cloud policy | 177 // global PolicyService instance. This works by installing the cloud policy |
| 176 // provider of the primary profile as the delegate of the ProxyPolicyProvider, | 178 // provider of the primary profile as the delegate of the ProxyPolicyProvider, |
| 177 // after login. | 179 // after login. |
| 178 // The provider is owned by the base class; this field is just a typed weak | 180 // The provider is owned by the base class; this field is just a typed weak |
| 179 // pointer to get to the ProxyPolicyProvider at SetUserPolicyDelegate(). | 181 // pointer to get to the ProxyPolicyProvider at SetUserPolicyDelegate(). |
| 180 ProxyPolicyProvider* global_user_cloud_policy_provider_; | 182 ProxyPolicyProvider* global_user_cloud_policy_provider_; |
| 181 | 183 |
| 182 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; | 184 std::unique_ptr<NetworkConfigurationUpdater> network_configuration_updater_; |
| 183 | 185 |
| 184 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; | 186 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; |
| 185 | 187 |
| 186 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); | 188 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); |
| 187 }; | 189 }; |
| 188 | 190 |
| 189 } // namespace policy | 191 } // namespace policy |
| 190 | 192 |
| 191 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ | 193 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ |
| OLD | NEW |