OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/common/notification_observer.h" |
| 12 #include "chrome/common/notification_registrar.h" |
| 13 |
| 14 class PrefService; |
| 15 class TestingBrowserProcess; |
| 16 class TokenService; |
| 17 class URLRequestContextGetter; |
| 18 |
| 19 namespace policy { |
| 20 |
| 21 class CloudPolicyIdentityStrategy; |
| 22 class CloudPolicySubsystem; |
| 23 class ConfigurationPolicyProvider; |
| 24 |
| 25 // Manages the lifecycle of browser-global policy infrastructure, such as the |
| 26 // platform policy providers. |
| 27 class BrowserPolicyConnector : public NotificationObserver { |
| 28 public: |
| 29 static const int kDefaultPolicyRefreshRateInMilliseconds = |
| 30 3 * 60 * 60 * 1000; // 3 hours. |
| 31 |
| 32 BrowserPolicyConnector(); |
| 33 ~BrowserPolicyConnector(); |
| 34 |
| 35 ConfigurationPolicyProvider* GetManagedPlatformProvider() const; |
| 36 ConfigurationPolicyProvider* GetManagedCloudProvider() const; |
| 37 ConfigurationPolicyProvider* GetRecommendedPlatformProvider() const; |
| 38 ConfigurationPolicyProvider* GetRecommendedCloudProvider() const; |
| 39 |
| 40 static void RegisterPrefs(PrefService* user_prefs); |
| 41 |
| 42 // NotificationObserver implementation: |
| 43 virtual void Observe(NotificationType type, |
| 44 const NotificationSource& source, |
| 45 const NotificationDetails& details); |
| 46 |
| 47 private: |
| 48 friend class ::TestingBrowserProcess; |
| 49 |
| 50 static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); |
| 51 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); |
| 52 |
| 53 // Constructor for tests that allows tests to use fake platform policy |
| 54 // providers instead of using the actual ones. |
| 55 BrowserPolicyConnector( |
| 56 ConfigurationPolicyProvider* managed_platform_provider, |
| 57 ConfigurationPolicyProvider* recommended_platform_provider); |
| 58 |
| 59 // Activates the cloud policy subsystem. Called when the default request |
| 60 // context is available. |
| 61 void Initialize(PrefService* local_state, |
| 62 URLRequestContextGetter* request_context); |
| 63 |
| 64 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_; |
| 65 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_; |
| 66 |
| 67 scoped_ptr<CloudPolicyIdentityStrategy> identity_strategy_; |
| 68 scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_; |
| 69 |
| 70 NotificationRegistrar registrar_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); |
| 73 }; |
| 74 |
| 75 } // namespace policy |
| 76 |
| 77 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
OLD | NEW |