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

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

Issue 10449071: Enable user policy handling through the new cloud policy stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/policy/browser_policy_connector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.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/cloud_policy_constants.h" 14 #include "chrome/browser/policy/cloud_policy_constants.h"
15 #include "chrome/browser/policy/configuration_policy_handler_list.h" 15 #include "chrome/browser/policy/configuration_policy_handler_list.h"
16 #include "chrome/browser/policy/enterprise_install_attributes.h" 16 #include "chrome/browser/policy/enterprise_install_attributes.h"
17 #include "chrome/browser/policy/proxy_policy_provider.h"
17 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
19 20
20 class Profile; 21 class Profile;
21 class TokenService; 22 class TokenService;
22 23
23 namespace policy { 24 namespace policy {
24 25
25 class AppPackUpdater; 26 class AppPackUpdater;
26 class CloudPolicyDataStore; 27 class CloudPolicyDataStore;
27 class CloudPolicyProvider; 28 class CloudPolicyProvider;
28 class CloudPolicySubsystem; 29 class CloudPolicySubsystem;
29 class ConfigurationPolicyProvider; 30 class ConfigurationPolicyProvider;
31 class DeviceManagementService;
30 class PolicyService; 32 class PolicyService;
33 class UserCloudPolicyManager;
31 class UserPolicyTokenCache; 34 class UserPolicyTokenCache;
32 35
33 // Manages the lifecycle of browser-global policy infrastructure, such as the 36 // Manages the lifecycle of browser-global policy infrastructure, such as the
34 // platform policy providers, device- and the user-cloud policy infrastructure. 37 // platform policy providers, device- and the user-cloud policy infrastructure.
35 // TODO(gfeher,mnissler): Factor out device and user specific methods into their 38 // TODO(gfeher,mnissler): Factor out device and user specific methods into their
36 // respective classes. 39 // respective classes.
37 class BrowserPolicyConnector : public content::NotificationObserver { 40 class BrowserPolicyConnector : public content::NotificationObserver {
38 public: 41 public:
39 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. 42 // Builds an uninitialized BrowserPolicyConnector, suitable for testing.
40 // Init() should be called to create and start the policy machinery. 43 // Init() should be called to create and start the policy machinery.
41 BrowserPolicyConnector(); 44 BrowserPolicyConnector();
42 virtual ~BrowserPolicyConnector(); 45 virtual ~BrowserPolicyConnector();
43 46
44 // Creates the policy providers and finalizes the initialization of the 47 // Creates the policy providers and finalizes the initialization of the
45 // connector. This call can be skipped on tests that don't require the full 48 // connector. This call can be skipped on tests that don't require the full
46 // policy system running. 49 // policy system running.
47 void Init(); 50 void Init();
48 51
49 // Creates a new policy service for the given profile, or a global one if 52 // Creates a new policy service for the given profile, or a global one if
50 // it is NULL. Ownership is transferred to the caller. 53 // it is NULL. Ownership is transferred to the caller.
51 PolicyService* CreatePolicyService(Profile* profile) const; 54 PolicyService* CreatePolicyService(Profile* profile);
52 55
53 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the 56 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the
54 // device policy managed by this policy connector, or NULL if no such 57 // device policy managed by this policy connector, or NULL if no such
55 // subsystem exists (i.e. when running outside ChromeOS). 58 // subsystem exists (i.e. when running outside ChromeOS).
56 CloudPolicySubsystem* device_cloud_policy_subsystem() { 59 CloudPolicySubsystem* device_cloud_policy_subsystem() {
57 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
58 return device_cloud_policy_subsystem_.get(); 61 return device_cloud_policy_subsystem_.get();
59 #else 62 #else
60 return NULL; 63 return NULL;
61 #endif 64 #endif
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Initializes the device cloud policy infrasturcture. 149 // Initializes the device cloud policy infrasturcture.
147 void InitializeDevicePolicy(); 150 void InitializeDevicePolicy();
148 151
149 // Complete initialization once the message loops are running and the 152 // Complete initialization once the message loops are running and the
150 // local_state is initialized. 153 // local_state is initialized.
151 void CompleteInitialization(); 154 void CompleteInitialization();
152 155
153 static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); 156 static ConfigurationPolicyProvider* CreateManagedPlatformProvider();
154 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); 157 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider();
155 158
159 // Used to convert policies to preferences. The providers declared below
160 // trigger policy updates during destruction via OnProviderGoingAway(), which
161 // will result in |handler_list_| being consulted for policy translation.
162 // Therefore, it's important to destroy |handler_list_| after the providers.
163 ConfigurationPolicyHandlerList handler_list_;
164
156 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_; 165 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_;
157 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_; 166 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_;
158 167
159 scoped_ptr<CloudPolicyProvider> managed_cloud_provider_; 168 scoped_ptr<CloudPolicyProvider> managed_cloud_provider_;
160 scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; 169 scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_;
161 170
162 #if defined(OS_CHROMEOS) 171 #if defined(OS_CHROMEOS)
163 scoped_ptr<CloudPolicyDataStore> device_data_store_; 172 scoped_ptr<CloudPolicyDataStore> device_data_store_;
164 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_; 173 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_;
165 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; 174 scoped_ptr<EnterpriseInstallAttributes> install_attributes_;
166 #endif 175 #endif
167 176
168 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; 177 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_;
169 scoped_ptr<CloudPolicyDataStore> user_data_store_; 178 scoped_ptr<CloudPolicyDataStore> user_data_store_;
170 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; 179 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_;
171 180
181 // Components of the new-style cloud policy implementation.
182 // TODO(mnissler): Remove the old-style components above once we have
183 // completed the switch to the new cloud policy implementation.
184 scoped_ptr<DeviceManagementService> device_management_service_;
185
186 ProxyPolicyProvider user_cloud_policy_provider_;
187 scoped_ptr<UserCloudPolicyManager> user_cloud_policy_manager_;
188
172 // Used to initialize the device policy subsystem once the message loops 189 // Used to initialize the device policy subsystem once the message loops
173 // are spinning. 190 // are spinning.
174 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; 191 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_;
175 192
176 // Registers the provider for notification of successful Gaia logins. 193 // Registers the provider for notification of successful Gaia logins.
177 content::NotificationRegistrar registrar_; 194 content::NotificationRegistrar registrar_;
178 195
179 // Weak reference to the TokenService we are listening to for user cloud 196 // Weak reference to the TokenService we are listening to for user cloud
180 // policy authentication tokens. 197 // policy authentication tokens.
181 TokenService* token_service_; 198 TokenService* token_service_;
182 199
183 // Used to convert policies to preferences.
184 ConfigurationPolicyHandlerList handler_list_;
185
186 #if defined(OS_CHROMEOS) 200 #if defined(OS_CHROMEOS)
187 scoped_ptr<AppPackUpdater> app_pack_updater_; 201 scoped_ptr<AppPackUpdater> app_pack_updater_;
188 #endif 202 #endif
189 203
190 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); 204 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector);
191 }; 205 };
192 206
193 } // namespace policy 207 } // namespace policy
194 208
195 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ 209 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698