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 <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.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 chromeos { | 23 namespace chromeos { |
| 24 |
| 25 class InstallAttributes; |
| 26 |
24 namespace attestation { | 27 namespace attestation { |
25 class AttestationFlow; | 28 class AttestationFlow; |
26 } | 29 } |
27 } | 30 } |
28 | 31 |
29 namespace net { | 32 namespace net { |
30 class URLRequestContextGetter; | 33 class URLRequestContextGetter; |
31 } | 34 } |
32 | 35 |
33 namespace policy { | 36 namespace policy { |
34 | 37 |
35 class AffiliatedCloudPolicyInvalidator; | 38 class AffiliatedCloudPolicyInvalidator; |
36 class AffiliatedInvalidationServiceProvider; | 39 class AffiliatedInvalidationServiceProvider; |
37 class AffiliatedRemoteCommandsInvalidator; | 40 class AffiliatedRemoteCommandsInvalidator; |
38 class BluetoothPolicyHandler; | 41 class BluetoothPolicyHandler; |
39 class DeviceCloudPolicyInitializer; | 42 class DeviceCloudPolicyInitializer; |
40 class DeviceLocalAccountPolicyService; | 43 class DeviceLocalAccountPolicyService; |
41 class DeviceManagementService; | 44 class DeviceManagementService; |
42 struct EnrollmentConfig; | 45 struct EnrollmentConfig; |
43 class EnterpriseInstallAttributes; | |
44 class NetworkConfigurationUpdater; | 46 class NetworkConfigurationUpdater; |
45 class ProxyPolicyProvider; | 47 class ProxyPolicyProvider; |
46 class ServerBackedStateKeysBroker; | 48 class ServerBackedStateKeysBroker; |
47 | 49 |
48 // Extends ChromeBrowserPolicyConnector with the setup specific to Chrome OS. | 50 // Extends ChromeBrowserPolicyConnector with the setup specific to Chrome OS. |
49 class BrowserPolicyConnectorChromeOS | 51 class BrowserPolicyConnectorChromeOS |
50 : public ChromeBrowserPolicyConnector, | 52 : public ChromeBrowserPolicyConnector, |
51 public DeviceCloudPolicyManagerChromeOS::Observer { | 53 public DeviceCloudPolicyManagerChromeOS::Observer { |
52 public: | 54 public: |
53 BrowserPolicyConnectorChromeOS(); | 55 BrowserPolicyConnectorChromeOS(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 97 } |
96 | 98 |
97 DeviceCloudPolicyInitializer* GetDeviceCloudPolicyInitializer() const { | 99 DeviceCloudPolicyInitializer* GetDeviceCloudPolicyInitializer() const { |
98 return device_cloud_policy_initializer_.get(); | 100 return device_cloud_policy_initializer_.get(); |
99 } | 101 } |
100 | 102 |
101 DeviceLocalAccountPolicyService* GetDeviceLocalAccountPolicyService() const { | 103 DeviceLocalAccountPolicyService* GetDeviceLocalAccountPolicyService() const { |
102 return device_local_account_policy_service_.get(); | 104 return device_local_account_policy_service_.get(); |
103 } | 105 } |
104 | 106 |
105 EnterpriseInstallAttributes* GetInstallAttributes() const { | 107 chromeos::InstallAttributes* GetInstallAttributes() const { |
106 return install_attributes_.get(); | 108 return install_attributes_.get(); |
107 } | 109 } |
108 | 110 |
109 ServerBackedStateKeysBroker* GetStateKeysBroker() const { | 111 ServerBackedStateKeysBroker* GetStateKeysBroker() const { |
110 return state_keys_broker_.get(); | 112 return state_keys_broker_.get(); |
111 } | 113 } |
112 | 114 |
113 // The browser-global PolicyService is created before Profiles are ready, to | 115 // The browser-global PolicyService is created before Profiles are ready, to |
114 // provide managed values for the local state PrefService. It includes a | 116 // provide managed values for the local state PrefService. It includes a |
115 // policy provider that forwards policies from a delegate policy provider. | 117 // policy provider that forwards policies from a delegate policy provider. |
116 // This call can be used to set the user policy provider as that delegate | 118 // This call can be used to set the user policy provider as that delegate |
117 // once the Profile is ready, so that user policies can also affect local | 119 // once the Profile is ready, so that user policies can also affect local |
118 // state preferences. | 120 // state preferences. |
119 // Only one user policy provider can be set as a delegate at a time, and any | 121 // Only one user policy provider can be set as a delegate at a time, and any |
120 // previously set delegate is removed. Passing NULL removes the current | 122 // previously set delegate is removed. Passing NULL removes the current |
121 // delegate, if there is one. | 123 // delegate, if there is one. |
122 void SetUserPolicyDelegate(ConfigurationPolicyProvider* user_policy_provider); | 124 void SetUserPolicyDelegate(ConfigurationPolicyProvider* user_policy_provider); |
123 | 125 |
124 // Sets the device cloud policy initializer for testing. | 126 // Sets the device cloud policy initializer for testing. |
125 void SetDeviceCloudPolicyInitializerForTesting( | 127 void SetDeviceCloudPolicyInitializerForTesting( |
126 std::unique_ptr<DeviceCloudPolicyInitializer> initializer); | 128 std::unique_ptr<DeviceCloudPolicyInitializer> initializer); |
127 | 129 |
128 // Sets the install attributes for testing. Must be called before the browser | 130 // Sets the install attributes for testing. Must be called before the browser |
129 // is created. RemoveInstallAttributesForTesting must be called after the test | 131 // is created. RemoveInstallAttributesForTesting must be called after the test |
130 // to free the attributes. | 132 // to free the attributes. |
131 static void SetInstallAttributesForTesting( | 133 static void SetInstallAttributesForTesting( |
132 EnterpriseInstallAttributes* attributes); | 134 chromeos::InstallAttributes* attributes); |
133 static void RemoveInstallAttributesForTesting(); | 135 static void RemoveInstallAttributesForTesting(); |
134 | 136 |
135 // Registers device refresh rate pref. | 137 // Registers device refresh rate pref. |
136 static void RegisterPrefs(PrefRegistrySimple* registry); | 138 static void RegisterPrefs(PrefRegistrySimple* registry); |
137 | 139 |
138 // DeviceCloudPolicyManagerChromeOS::Observer: | 140 // DeviceCloudPolicyManagerChromeOS::Observer: |
139 void OnDeviceCloudPolicyManagerConnected() override; | 141 void OnDeviceCloudPolicyManagerConnected() override; |
140 void OnDeviceCloudPolicyManagerDisconnected() override; | 142 void OnDeviceCloudPolicyManagerDisconnected() override; |
141 | 143 |
142 chromeos::AffiliationIDSet GetDeviceAffiliationIDs() const; | 144 chromeos::AffiliationIDSet GetDeviceAffiliationIDs() const; |
143 | 145 |
144 private: | 146 private: |
145 // Set the timezone as soon as the policies are available. | 147 // Set the timezone as soon as the policies are available. |
146 void SetTimezoneIfPolicyAvailable(); | 148 void SetTimezoneIfPolicyAvailable(); |
147 | 149 |
148 // Restarts the device cloud policy initializer, because the device's | 150 // Restarts the device cloud policy initializer, because the device's |
149 // registration status changed from registered to unregistered. | 151 // registration status changed from registered to unregistered. |
150 void RestartDeviceCloudPolicyInitializer(); | 152 void RestartDeviceCloudPolicyInitializer(); |
151 | 153 |
152 // Creates an attestation flow using our async method handler and | 154 // Creates an attestation flow using our async method handler and |
153 // cryptohome client. | 155 // cryptohome client. |
154 std::unique_ptr<chromeos::attestation::AttestationFlow> | 156 std::unique_ptr<chromeos::attestation::AttestationFlow> |
155 CreateAttestationFlow(); | 157 CreateAttestationFlow(); |
156 | 158 |
157 // Components of the device cloud policy implementation. | 159 // Components of the device cloud policy implementation. |
158 std::unique_ptr<ServerBackedStateKeysBroker> state_keys_broker_; | 160 std::unique_ptr<ServerBackedStateKeysBroker> state_keys_broker_; |
159 std::unique_ptr<EnterpriseInstallAttributes> install_attributes_; | 161 std::unique_ptr<chromeos::InstallAttributes> install_attributes_; |
160 std::unique_ptr<AffiliatedInvalidationServiceProvider> | 162 std::unique_ptr<AffiliatedInvalidationServiceProvider> |
161 affiliated_invalidation_service_provider_; | 163 affiliated_invalidation_service_provider_; |
162 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; | 164 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; |
163 PrefService* local_state_; | 165 PrefService* local_state_; |
164 std::unique_ptr<DeviceCloudPolicyInitializer> | 166 std::unique_ptr<DeviceCloudPolicyInitializer> |
165 device_cloud_policy_initializer_; | 167 device_cloud_policy_initializer_; |
166 std::unique_ptr<DeviceLocalAccountPolicyService> | 168 std::unique_ptr<DeviceLocalAccountPolicyService> |
167 device_local_account_policy_service_; | 169 device_local_account_policy_service_; |
168 std::unique_ptr<AffiliatedCloudPolicyInvalidator> | 170 std::unique_ptr<AffiliatedCloudPolicyInvalidator> |
169 device_cloud_policy_invalidator_; | 171 device_cloud_policy_invalidator_; |
(...skipping 13 matching lines...) Expand all Loading... |
183 std::unique_ptr<NetworkConfigurationUpdater> network_configuration_updater_; | 185 std::unique_ptr<NetworkConfigurationUpdater> network_configuration_updater_; |
184 | 186 |
185 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; | 187 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; |
186 | 188 |
187 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); |
188 }; | 190 }; |
189 | 191 |
190 } // namespace policy | 192 } // namespace policy |
191 | 193 |
192 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ | 194 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ |
OLD | NEW |