Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 ProxyPolicyProvider; | |
|
Joao da Silva
2012/06/05 07:21:46
Nit: header is included
Mattias Nissler (ping if slow)
2012/06/05 10:27:21
Done.
| |
| 34 class UserCloudPolicyManager; | |
| 31 class UserPolicyTokenCache; | 35 class UserPolicyTokenCache; |
| 32 | 36 |
| 33 // Manages the lifecycle of browser-global policy infrastructure, such as the | 37 // Manages the lifecycle of browser-global policy infrastructure, such as the |
| 34 // platform policy providers, device- and the user-cloud policy infrastructure. | 38 // platform policy providers, device- and the user-cloud policy infrastructure. |
| 35 // TODO(gfeher,mnissler): Factor out device and user specific methods into their | 39 // TODO(gfeher,mnissler): Factor out device and user specific methods into their |
| 36 // respective classes. | 40 // respective classes. |
| 37 class BrowserPolicyConnector : public content::NotificationObserver { | 41 class BrowserPolicyConnector : public content::NotificationObserver { |
| 38 public: | 42 public: |
| 39 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. | 43 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. |
| 40 // Init() should be called to create and start the policy machinery. | 44 // Init() should be called to create and start the policy machinery. |
| 41 BrowserPolicyConnector(); | 45 BrowserPolicyConnector(); |
| 42 virtual ~BrowserPolicyConnector(); | 46 virtual ~BrowserPolicyConnector(); |
| 43 | 47 |
| 44 // Creates the policy providers and finalizes the initialization of the | 48 // 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 | 49 // connector. This call can be skipped on tests that don't require the full |
| 46 // policy system running. | 50 // policy system running. |
| 47 void Init(); | 51 void Init(); |
| 48 | 52 |
| 49 // Creates a new policy service for the given profile, or a global one if | 53 // Creates a new policy service for the given profile, or a global one if |
| 50 // it is NULL. Ownership is transferred to the caller. | 54 // it is NULL. Ownership is transferred to the caller. |
| 51 PolicyService* CreatePolicyService(Profile* profile) const; | 55 PolicyService* CreatePolicyService(Profile* profile); |
| 52 | 56 |
| 53 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the | 57 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the |
| 54 // device policy managed by this policy connector, or NULL if no such | 58 // device policy managed by this policy connector, or NULL if no such |
| 55 // subsystem exists (i.e. when running outside ChromeOS). | 59 // subsystem exists (i.e. when running outside ChromeOS). |
| 56 CloudPolicySubsystem* device_cloud_policy_subsystem() { | 60 CloudPolicySubsystem* device_cloud_policy_subsystem() { |
| 57 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 58 return device_cloud_policy_subsystem_.get(); | 62 return device_cloud_policy_subsystem_.get(); |
| 59 #else | 63 #else |
| 60 return NULL; | 64 return NULL; |
| 61 #endif | 65 #endif |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 #if defined(OS_CHROMEOS) | 166 #if defined(OS_CHROMEOS) |
| 163 scoped_ptr<CloudPolicyDataStore> device_data_store_; | 167 scoped_ptr<CloudPolicyDataStore> device_data_store_; |
| 164 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_; | 168 scoped_ptr<CloudPolicySubsystem> device_cloud_policy_subsystem_; |
| 165 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; | 169 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; |
| 166 #endif | 170 #endif |
| 167 | 171 |
| 168 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; | 172 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; |
| 169 scoped_ptr<CloudPolicyDataStore> user_data_store_; | 173 scoped_ptr<CloudPolicyDataStore> user_data_store_; |
| 170 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; | 174 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; |
| 171 | 175 |
| 176 // Components of the new-style cloud policy implementation. | |
| 177 // TODO(mnissler): Remove the old-style components above once we have | |
| 178 // completed the switch to the new cloud policy implementation. | |
| 179 scoped_ptr<DeviceManagementService> device_management_service_; | |
| 180 | |
| 181 ProxyPolicyProvider user_cloud_policy_provider_; | |
|
Joao da Silva
2012/06/05 07:21:46
This will be deleted after the |handler_list_|, le
Mattias Nissler (ping if slow)
2012/06/05 10:27:21
Done.
| |
| 182 scoped_ptr<UserCloudPolicyManager> user_cloud_policy_manager_; | |
| 183 | |
| 172 // Used to initialize the device policy subsystem once the message loops | 184 // Used to initialize the device policy subsystem once the message loops |
| 173 // are spinning. | 185 // are spinning. |
| 174 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; | 186 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; |
| 175 | 187 |
| 176 // Registers the provider for notification of successful Gaia logins. | 188 // Registers the provider for notification of successful Gaia logins. |
| 177 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
| 178 | 190 |
| 179 // Weak reference to the TokenService we are listening to for user cloud | 191 // Weak reference to the TokenService we are listening to for user cloud |
| 180 // policy authentication tokens. | 192 // policy authentication tokens. |
| 181 TokenService* token_service_; | 193 TokenService* token_service_; |
| 182 | 194 |
| 183 // Used to convert policies to preferences. | 195 // Used to convert policies to preferences. |
| 184 ConfigurationPolicyHandlerList handler_list_; | 196 ConfigurationPolicyHandlerList handler_list_; |
| 185 | 197 |
| 186 #if defined(OS_CHROMEOS) | 198 #if defined(OS_CHROMEOS) |
| 187 scoped_ptr<AppPackUpdater> app_pack_updater_; | 199 scoped_ptr<AppPackUpdater> app_pack_updater_; |
| 188 #endif | 200 #endif |
| 189 | 201 |
| 190 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); | 202 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); |
| 191 }; | 203 }; |
| 192 | 204 |
| 193 } // namespace policy | 205 } // namespace policy |
| 194 | 206 |
| 195 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 207 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| OLD | NEW |