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_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONTEXT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/scoped_ptr.h" |
| 11 |
| 12 class PrefService; |
| 13 class TokenService; |
| 14 class URLRequestContextGetter; |
| 15 |
| 16 namespace policy { |
| 17 |
| 18 class CloudPolicyContext; |
| 19 class CloudPolicyController; |
| 20 class ConfigurationPolicyProvider; |
| 21 |
| 22 // Manages the lifecycle of browser-global policy infrastructure, such as the |
| 23 // platform policy providers. |
| 24 class BrowserPolicyContext { |
| 25 public: |
| 26 BrowserPolicyContext(); |
| 27 // Constructor for tests that allows tests to use fake platform policy |
| 28 // providers instead of using the actual ones. |
| 29 BrowserPolicyContext( |
| 30 ConfigurationPolicyProvider* managed_platform_provider, |
| 31 ConfigurationPolicyProvider* recommended_platform_provider); |
| 32 ~BrowserPolicyContext(); |
| 33 |
| 34 // Activates the cloud policy context. We can't pass these in the constructor |
| 35 // since the context must start up before threading and net is up. |
| 36 void Initialize(PrefService* local_state, |
| 37 URLRequestContextGetter* request_context); |
| 38 |
| 39 ConfigurationPolicyProvider* GetManagedPlatformProvider() const; |
| 40 ConfigurationPolicyProvider* GetManagedCloudProvider() const; |
| 41 ConfigurationPolicyProvider* GetRecommendedPlatformProvider() const; |
| 42 ConfigurationPolicyProvider* GetRecommendedCloudProvider() const; |
| 43 |
| 44 static void RegisterPrefs(PrefService* user_prefs); |
| 45 |
| 46 static const int kDefaultPolicyRefreshRateInMilliseconds = |
| 47 3 * 60 * 60 * 1000; // 3 hours. |
| 48 |
| 49 private: |
| 50 static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); |
| 51 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); |
| 52 |
| 53 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_; |
| 54 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_; |
| 55 |
| 56 scoped_ptr<CloudPolicyController> controller_; |
| 57 scoped_ptr<CloudPolicyContext> cloud_context_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyContext); |
| 60 }; |
| 61 |
| 62 } // namespace policy |
| 63 |
| 64 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONTEXT_H_ |
OLD | NEW |