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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/policy/chrome_browser_policy_connector.h" | 14 #include "chrome/browser/policy/chrome_browser_policy_connector.h" |
15 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
16 | 16 |
17 class PrefRegistrySimple; | 17 class PrefRegistrySimple; |
18 class PrefService; | 18 class PrefService; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
22 } | 22 } |
23 | 23 |
24 namespace policy { | 24 namespace policy { |
25 | 25 |
26 class AppPackUpdater; | 26 class AppPackUpdater; |
27 class DeviceCloudPolicyManagerChromeOS; | 27 class DeviceCloudPolicyManagerChromeOS; |
28 class DeviceLocalAccountPolicyService; | 28 class DeviceLocalAccountPolicyService; |
| 29 class DeviceManagementService; |
29 class EnterpriseInstallAttributes; | 30 class EnterpriseInstallAttributes; |
30 class NetworkConfigurationUpdater; | 31 class NetworkConfigurationUpdater; |
31 class ProxyPolicyProvider; | 32 class ProxyPolicyProvider; |
32 | 33 |
33 // Extends ChromeBrowserPolicyConnector with the setup specific to ChromeOS. | 34 // Extends ChromeBrowserPolicyConnector with the setup specific to ChromeOS. |
34 class BrowserPolicyConnectorChromeOS : public ChromeBrowserPolicyConnector { | 35 class BrowserPolicyConnectorChromeOS : public ChromeBrowserPolicyConnector { |
35 public: | 36 public: |
36 BrowserPolicyConnectorChromeOS(); | 37 BrowserPolicyConnectorChromeOS(); |
37 | 38 |
38 virtual ~BrowserPolicyConnectorChromeOS(); | 39 virtual ~BrowserPolicyConnectorChromeOS(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // provide managed values for the local state PrefService. It includes a | 79 // provide managed values for the local state PrefService. It includes a |
79 // policy provider that forwards policies from a delegate policy provider. | 80 // policy provider that forwards policies from a delegate policy provider. |
80 // This call can be used to set the user policy provider as that delegate | 81 // This call can be used to set the user policy provider as that delegate |
81 // once the Profile is ready, so that user policies can also affect local | 82 // once the Profile is ready, so that user policies can also affect local |
82 // state preferences. | 83 // state preferences. |
83 // Only one user policy provider can be set as a delegate at a time, and any | 84 // Only one user policy provider can be set as a delegate at a time, and any |
84 // previously set delegate is removed. Passing NULL removes the current | 85 // previously set delegate is removed. Passing NULL removes the current |
85 // delegate, if there is one. | 86 // delegate, if there is one. |
86 void SetUserPolicyDelegate(ConfigurationPolicyProvider* user_policy_provider); | 87 void SetUserPolicyDelegate(ConfigurationPolicyProvider* user_policy_provider); |
87 | 88 |
| 89 // Returns the device management service for consumer management. |
| 90 DeviceManagementService* consumer_device_management_service() const { |
| 91 return consumer_device_management_service_.get(); |
| 92 } |
| 93 |
88 // Sets the install attributes for testing. Must be called before the browser | 94 // Sets the install attributes for testing. Must be called before the browser |
89 // is created. Takes ownership of |attributes|. | 95 // is created. Takes ownership of |attributes|. |
90 static void SetInstallAttributesForTesting( | 96 static void SetInstallAttributesForTesting( |
91 EnterpriseInstallAttributes* attributes); | 97 EnterpriseInstallAttributes* attributes); |
92 | 98 |
93 // Registers device refresh rate pref. | 99 // Registers device refresh rate pref. |
94 static void RegisterPrefs(PrefRegistrySimple* registry); | 100 static void RegisterPrefs(PrefRegistrySimple* registry); |
95 | 101 |
96 private: | 102 private: |
97 // Set the timezone as soon as the policies are available. | 103 // Set the timezone as soon as the policies are available. |
98 void SetTimezoneIfPolicyAvailable(); | 104 void SetTimezoneIfPolicyAvailable(); |
99 | 105 |
100 // Components of the device cloud policy implementation. | 106 // Components of the device cloud policy implementation. |
101 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; | 107 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; |
102 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; | 108 DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; |
103 scoped_ptr<DeviceLocalAccountPolicyService> | 109 scoped_ptr<DeviceLocalAccountPolicyService> |
104 device_local_account_policy_service_; | 110 device_local_account_policy_service_; |
105 | 111 |
106 // This policy provider is used on Chrome OS to feed user policy into the | 112 // This policy provider is used on Chrome OS to feed user policy into the |
107 // global PolicyService instance. This works by installing the cloud policy | 113 // global PolicyService instance. This works by installing the cloud policy |
108 // provider of the primary profile as the delegate of the ProxyPolicyProvider, | 114 // provider of the primary profile as the delegate of the ProxyPolicyProvider, |
109 // after login. | 115 // after login. |
110 // The provider is owned by the base class; this field is just a typed weak | 116 // The provider is owned by the base class; this field is just a typed weak |
111 // pointer to get to the ProxyPolicyProvider at SetUserPolicyDelegate(). | 117 // pointer to get to the ProxyPolicyProvider at SetUserPolicyDelegate(). |
112 ProxyPolicyProvider* global_user_cloud_policy_provider_; | 118 ProxyPolicyProvider* global_user_cloud_policy_provider_; |
113 | 119 |
114 scoped_ptr<AppPackUpdater> app_pack_updater_; | 120 scoped_ptr<AppPackUpdater> app_pack_updater_; |
115 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; | 121 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; |
116 | 122 |
| 123 scoped_ptr<DeviceManagementService> consumer_device_management_service_; |
| 124 |
117 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; | 125 base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; |
118 | 126 |
119 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); | 127 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS); |
120 }; | 128 }; |
121 | 129 |
122 } // namespace policy | 130 } // namespace policy |
123 | 131 |
124 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_POLICY_BROWSER_POLICY_CONNECTOR_CHROMEOS_H_ |
OLD | NEW |