Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: chrome/browser/policy/browser_policy_connector.h

Issue 11415094: Split UserCloudPolicyManager implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Crazy ProfileKeyedService hackery. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_POLICY_BROWSER_POLICY_CONNECTOR_H_ 5 #ifndef CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 class AppPackUpdater; 25 class AppPackUpdater;
26 class CloudPolicyDataStore; 26 class CloudPolicyDataStore;
27 class CloudPolicyProvider; 27 class CloudPolicyProvider;
28 class CloudPolicySubsystem; 28 class CloudPolicySubsystem;
29 class ConfigurationPolicyProvider; 29 class ConfigurationPolicyProvider;
30 class DeviceCloudPolicyManagerChromeOS; 30 class DeviceCloudPolicyManagerChromeOS;
31 class DeviceManagementService; 31 class DeviceManagementService;
32 class NetworkConfigurationUpdater; 32 class NetworkConfigurationUpdater;
33 class PolicyService; 33 class PolicyService;
34 class PolicyStatisticsCollector; 34 class PolicyStatisticsCollector;
35 class UserCloudPolicyManager; 35 class UserCloudPolicyManagerChromeOS;
36 class UserPolicyTokenCache; 36 class UserPolicyTokenCache;
37 37
38 // Manages the lifecycle of browser-global policy infrastructure, such as the 38 // Manages the lifecycle of browser-global policy infrastructure, such as the
39 // platform policy providers, device- and the user-cloud policy infrastructure. 39 // platform policy providers, device- and the user-cloud policy infrastructure.
40 // TODO(gfeher,mnissler): Factor out device and user specific methods into their 40 // TODO(gfeher,mnissler): Factor out device and user specific methods into their
41 // respective classes. 41 // respective classes.
42 class BrowserPolicyConnector : public content::NotificationObserver { 42 class BrowserPolicyConnector : public content::NotificationObserver {
43 public: 43 public:
44 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. 44 // Builds an uninitialized BrowserPolicyConnector, suitable for testing.
45 // Init() should be called to create and start the policy machinery. 45 // Init() should be called to create and start the policy machinery.
46 BrowserPolicyConnector(); 46 BrowserPolicyConnector();
47 47
48 // Invoke Shutdown() before deleting, see below. 48 // Invoke Shutdown() before deleting, see below.
49 virtual ~BrowserPolicyConnector(); 49 virtual ~BrowserPolicyConnector();
50 50
51 // Creates the policy providers and finalizes the initialization of the 51 // Creates the policy providers and finalizes the initialization of the
52 // connector. This call can be skipped on tests that don't require the full 52 // connector. This call can be skipped on tests that don't require the full
53 // policy system running. 53 // policy system running.
54 void Init(); 54 void Init();
55 55
56 // Stops the policy providers and cleans up the connector before it can be 56 // Stops the policy providers and cleans up the connector before it can be
57 // safely deleted. This must be invoked before the destructor and while the 57 // safely deleted. This must be invoked before the destructor and while the
58 // threads are still running. The policy providers are still valid but won't 58 // threads are still running. The policy providers are still valid but won't
59 // update anymore after this call. 59 // update anymore after this call.
60 void Shutdown(); 60 void Shutdown();
61 61
62 // Returns true if Init() has been called but Shutdown() hasn't been yet. 62 // Returns true if Init() has been called but Shutdown() hasn't been yet.
63 bool is_initialized() const { return is_initialized_; } 63 bool is_initialized() const { return is_initialized_; }
64 64
65 // Creates a UserCloudPolicyManager for the given profile, or returns NULL if
66 // it is not supported on this platform. If |force_immediate_policy_load| is
67 // true, then any underlying policy files will be loaded before this routine
68 // returns - this is used when the caller (such as
69 // CreateProfile(CREATE_MODE_SYNCHRONOUS)) needs to access the policy values
70 // immediately without waiting for tasks to complete.
71 scoped_ptr<UserCloudPolicyManager> CreateCloudPolicyManager(
72 Profile* profile,
73 bool force_immediate_policy_load);
74
75 // Creates a new policy service for the given profile. 65 // Creates a new policy service for the given profile.
76 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile); 66 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile);
77 67
78 // Returns the browser-global PolicyService, that contains policies for the 68 // Returns the browser-global PolicyService, that contains policies for the
79 // whole browser. 69 // whole browser.
80 PolicyService* GetPolicyService(); 70 PolicyService* GetPolicyService();
81 71
82 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the 72 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the
83 // device policy managed by this policy connector, or NULL if no such 73 // device policy managed by this policy connector, or NULL if no such
84 // subsystem exists (i.e. when running outside ChromeOS). 74 // subsystem exists (i.e. when running outside ChromeOS).
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 NetworkConfigurationUpdater* GetNetworkConfigurationUpdater(); 157 NetworkConfigurationUpdater* GetNetworkConfigurationUpdater();
168 158
169 DeviceManagementService* device_management_service() { 159 DeviceManagementService* device_management_service() {
170 return device_management_service_.get(); 160 return device_management_service_.get();
171 } 161 }
172 162
173 #if defined(OS_CHROMEOS) 163 #if defined(OS_CHROMEOS)
174 DeviceCloudPolicyManagerChromeOS* GetDeviceCloudPolicyManager() { 164 DeviceCloudPolicyManagerChromeOS* GetDeviceCloudPolicyManager() {
175 return device_cloud_policy_manager_.get(); 165 return device_cloud_policy_manager_.get();
176 } 166 }
167 UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManager() {
168 return user_cloud_policy_manager_.get();
169 }
177 #endif 170 #endif
178 171
179 // Sets a |provider| that will be included in PolicyServices returned by 172 // Sets a |provider| that will be included in PolicyServices returned by
180 // CreatePolicyService. This is a static method because local state is 173 // CreatePolicyService. This is a static method because local state is
181 // created immediately after the connector, and tests don't have a chance to 174 // created immediately after the connector, and tests don't have a chance to
182 // inject the provider otherwise. |provider| must outlive the connector, and 175 // inject the provider otherwise. |provider| must outlive the connector, and
183 // its ownership is not taken though the connector will initialize and shut it 176 // its ownership is not taken though the connector will initialize and shut it
184 // down. 177 // down.
185 static void SetPolicyProviderForTesting( 178 static void SetPolicyProviderForTesting(
186 ConfigurationPolicyProvider* provider); 179 ConfigurationPolicyProvider* provider);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 218
226 scoped_ptr<ConfigurationPolicyProvider> platform_provider_; 219 scoped_ptr<ConfigurationPolicyProvider> platform_provider_;
227 scoped_ptr<CloudPolicyProvider> cloud_provider_; 220 scoped_ptr<CloudPolicyProvider> cloud_provider_;
228 221
229 // Components of the new-style cloud policy implementation. 222 // Components of the new-style cloud policy implementation.
230 // TODO(mnissler): Remove the old-style components below once we have 223 // TODO(mnissler): Remove the old-style components below once we have
231 // completed the switch to the new cloud policy implementation. 224 // completed the switch to the new cloud policy implementation.
232 #if defined(OS_CHROMEOS) 225 #if defined(OS_CHROMEOS)
233 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; 226 scoped_ptr<EnterpriseInstallAttributes> install_attributes_;
234 scoped_ptr<DeviceCloudPolicyManagerChromeOS> device_cloud_policy_manager_; 227 scoped_ptr<DeviceCloudPolicyManagerChromeOS> device_cloud_policy_manager_;
228 scoped_ptr<UserCloudPolicyManagerChromeOS> user_cloud_policy_manager_;
229
230 // This policy provider is used on Chrome OS to feed user policy into the
231 // global PolicyService instance. This works by installing
232 // |user_cloud_policy_manager_| as the delegate once the former is
233 // initialized.
234 ProxyPolicyProvider global_user_cloud_policy_provider_;
235 #endif 235 #endif
236 ProxyPolicyProvider user_cloud_policy_provider_;
237 236
238 // Must be deleted before all the policy providers. 237 // Must be deleted before all the policy providers.
239 scoped_ptr<PolicyService> policy_service_; 238 scoped_ptr<PolicyService> policy_service_;
240 239
241 #if defined(OS_CHROMEOS) 240 #if defined(OS_CHROMEOS)
242 scoped_ptr<CloudPolicyDataStore> device_data_store_; 241 scoped_ptr<CloudPolicyDataStore> device_data_store_;
243 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_; 242 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_;
244 #endif 243 #endif
245 244
246 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; 245 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_;
(...skipping 19 matching lines...) Expand all
266 scoped_ptr<AppPackUpdater> app_pack_updater_; 265 scoped_ptr<AppPackUpdater> app_pack_updater_;
267 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; 266 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_;
268 #endif 267 #endif
269 268
270 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); 269 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector);
271 }; 270 };
272 271
273 } // namespace policy 272 } // namespace policy
274 273
275 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ 274 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698