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

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: Fix DeviceCloudPolicyManagerChromeOSTest.EnrolledDevice failure. Created 8 years 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 15 matching lines...) Expand all
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 DeviceLocalAccountPolicyService; 31 class DeviceLocalAccountPolicyService;
32 class DeviceManagementService; 32 class DeviceManagementService;
33 class NetworkConfigurationUpdater; 33 class NetworkConfigurationUpdater;
34 class PolicyService; 34 class PolicyService;
35 class PolicyStatisticsCollector; 35 class PolicyStatisticsCollector;
36 class UserCloudPolicyManager; 36 class UserCloudPolicyManagerChromeOS;
37 class UserPolicyTokenCache; 37 class UserPolicyTokenCache;
38 38
39 // Manages the lifecycle of browser-global policy infrastructure, such as the 39 // Manages the lifecycle of browser-global policy infrastructure, such as the
40 // platform policy providers, device- and the user-cloud policy infrastructure. 40 // platform policy providers, device- and the user-cloud policy infrastructure.
41 // TODO(gfeher,mnissler): Factor out device and user specific methods into their 41 // TODO(gfeher,mnissler): Factor out device and user specific methods into their
42 // respective classes. 42 // respective classes.
43 class BrowserPolicyConnector : public content::NotificationObserver { 43 class BrowserPolicyConnector : public content::NotificationObserver {
44 public: 44 public:
45 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. 45 // Builds an uninitialized BrowserPolicyConnector, suitable for testing.
46 // Init() should be called to create and start the policy machinery. 46 // Init() should be called to create and start the policy machinery.
47 BrowserPolicyConnector(); 47 BrowserPolicyConnector();
48 48
49 // Invoke Shutdown() before deleting, see below. 49 // Invoke Shutdown() before deleting, see below.
50 virtual ~BrowserPolicyConnector(); 50 virtual ~BrowserPolicyConnector();
51 51
52 // Creates the policy providers and finalizes the initialization of the 52 // Creates the policy providers and finalizes the initialization of the
53 // connector. This call can be skipped on tests that don't require the full 53 // connector. This call can be skipped on tests that don't require the full
54 // policy system running. 54 // policy system running.
55 void Init(); 55 void Init();
56 56
57 // Stops the policy providers and cleans up the connector before it can be 57 // Stops the policy providers and cleans up the connector before it can be
58 // safely deleted. This must be invoked before the destructor and while the 58 // safely deleted. This must be invoked before the destructor and while the
59 // threads are still running. The policy providers are still valid but won't 59 // threads are still running. The policy providers are still valid but won't
60 // update anymore after this call. 60 // update anymore after this call.
61 void Shutdown(); 61 void Shutdown();
62 62
63 // Returns true if Init() has been called but Shutdown() hasn't been yet. 63 // Returns true if Init() has been called but Shutdown() hasn't been yet.
64 bool is_initialized() const { return is_initialized_; } 64 bool is_initialized() const { return is_initialized_; }
65 65
66 // Creates a UserCloudPolicyManager for the given profile, or returns NULL if
67 // it is not supported on this platform. If |force_immediate_policy_load| is
68 // true, then any underlying policy files will be loaded before this routine
69 // returns - this is used when the caller (such as
70 // CreateProfile(CREATE_MODE_SYNCHRONOUS)) needs to access the policy values
71 // immediately without waiting for tasks to complete.
72 scoped_ptr<UserCloudPolicyManager> CreateCloudPolicyManager(
73 Profile* profile,
74 bool force_immediate_policy_load);
75
76 // Creates a new policy service for the given profile. 66 // Creates a new policy service for the given profile.
77 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile); 67 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile);
78 68
79 // Returns the browser-global PolicyService, that contains policies for the 69 // Returns the browser-global PolicyService, that contains policies for the
80 // whole browser. 70 // whole browser.
81 PolicyService* GetPolicyService(); 71 PolicyService* GetPolicyService();
82 72
83 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the 73 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the
84 // device policy managed by this policy connector, or NULL if no such 74 // device policy managed by this policy connector, or NULL if no such
85 // subsystem exists (i.e. when running outside ChromeOS). 75 // subsystem exists (i.e. when running outside ChromeOS).
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 NetworkConfigurationUpdater* GetNetworkConfigurationUpdater(); 158 NetworkConfigurationUpdater* GetNetworkConfigurationUpdater();
169 159
170 DeviceManagementService* device_management_service() { 160 DeviceManagementService* device_management_service() {
171 return device_management_service_.get(); 161 return device_management_service_.get();
172 } 162 }
173 163
174 #if defined(OS_CHROMEOS) 164 #if defined(OS_CHROMEOS)
175 DeviceCloudPolicyManagerChromeOS* GetDeviceCloudPolicyManager() { 165 DeviceCloudPolicyManagerChromeOS* GetDeviceCloudPolicyManager() {
176 return device_cloud_policy_manager_.get(); 166 return device_cloud_policy_manager_.get();
177 } 167 }
168 UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManager() {
169 return user_cloud_policy_manager_.get();
170 }
178 #endif 171 #endif
179 172
180 // Sets a |provider| that will be included in PolicyServices returned by 173 // Sets a |provider| that will be included in PolicyServices returned by
181 // CreatePolicyService. This is a static method because local state is 174 // CreatePolicyService. This is a static method because local state is
182 // created immediately after the connector, and tests don't have a chance to 175 // created immediately after the connector, and tests don't have a chance to
183 // inject the provider otherwise. |provider| must outlive the connector, and 176 // inject the provider otherwise. |provider| must outlive the connector, and
184 // its ownership is not taken though the connector will initialize and shut it 177 // its ownership is not taken though the connector will initialize and shut it
185 // down. 178 // down.
186 static void SetPolicyProviderForTesting( 179 static void SetPolicyProviderForTesting(
187 ConfigurationPolicyProvider* provider); 180 ConfigurationPolicyProvider* provider);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 scoped_ptr<CloudPolicyProvider> cloud_provider_; 221 scoped_ptr<CloudPolicyProvider> cloud_provider_;
229 222
230 // Components of the new-style cloud policy implementation. 223 // Components of the new-style cloud policy implementation.
231 // TODO(mnissler): Remove the old-style components below once we have 224 // TODO(mnissler): Remove the old-style components below once we have
232 // completed the switch to the new cloud policy implementation. 225 // completed the switch to the new cloud policy implementation.
233 #if defined(OS_CHROMEOS) 226 #if defined(OS_CHROMEOS)
234 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; 227 scoped_ptr<EnterpriseInstallAttributes> install_attributes_;
235 scoped_ptr<DeviceCloudPolicyManagerChromeOS> device_cloud_policy_manager_; 228 scoped_ptr<DeviceCloudPolicyManagerChromeOS> device_cloud_policy_manager_;
236 scoped_ptr<DeviceLocalAccountPolicyService> 229 scoped_ptr<DeviceLocalAccountPolicyService>
237 device_local_account_policy_service_; 230 device_local_account_policy_service_;
231 scoped_ptr<UserCloudPolicyManagerChromeOS> user_cloud_policy_manager_;
232
233 // This policy provider is used on Chrome OS to feed user policy into the
234 // global PolicyService instance. This works by installing
235 // |user_cloud_policy_manager_| as the delegate once the former is
236 // initialized.
237 ProxyPolicyProvider global_user_cloud_policy_provider_;
238 #endif 238 #endif
239 ProxyPolicyProvider user_cloud_policy_provider_;
240 239
241 // Must be deleted before all the policy providers. 240 // Must be deleted before all the policy providers.
242 scoped_ptr<PolicyService> policy_service_; 241 scoped_ptr<PolicyService> policy_service_;
243 242
244 #if defined(OS_CHROMEOS) 243 #if defined(OS_CHROMEOS)
245 scoped_ptr<CloudPolicyDataStore> device_data_store_; 244 scoped_ptr<CloudPolicyDataStore> device_data_store_;
246 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_; 245 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_;
247 #endif 246 #endif
248 247
249 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; 248 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_;
(...skipping 19 matching lines...) Expand all
269 scoped_ptr<AppPackUpdater> app_pack_updater_; 268 scoped_ptr<AppPackUpdater> app_pack_updater_;
270 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; 269 scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_;
271 #endif 270 #endif
272 271
273 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); 272 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector);
274 }; 273 };
275 274
276 } // namespace policy 275 } // namespace policy
277 276
278 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ 277 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/policy_oauth_fetcher.cc ('k') | chrome/browser/policy/browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698