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_CLOUD_POLICY_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_CONTEXT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" |
| 11 #include "chrome/common/notification_observer.h" |
| 12 |
| 13 class FilePath; |
| 14 class PrefService; |
| 15 class URLRequestContextGetter; |
| 16 |
| 17 namespace policy { |
| 18 |
| 19 class CloudPolicyCache; |
| 20 class CloudPolicyClient; |
| 21 class CloudPolicyController; |
| 22 class ConfigurationPolicyProvider; |
| 23 class DeviceManagementService; |
| 24 class DeviceTokenFetcher; |
| 25 |
| 26 // This class is a container for the infrastructure required to support cloud |
| 27 // policy. It glues together the backend, the policy client and manages the live |
| 28 // cycle of the policy providers. |
| 29 class CloudPolicyContext : public NotificationObserver { |
| 30 public: |
| 31 CloudPolicyContext(const FilePath& policy_cache_file, |
| 32 CloudPolicyController* controller_); |
| 33 virtual ~CloudPolicyContext(); |
| 34 |
| 35 // Initializes the context. |
| 36 void Initialize(PrefService* prefs, |
| 37 const char* refresh_rate_pref_name, |
| 38 URLRequestContextGetter* request_context); |
| 39 |
| 40 // Shuts the context down. This must be called before threading and network |
| 41 // infrastructure goes away. |
| 42 void Shutdown(); |
| 43 |
| 44 ConfigurationPolicyProvider* GetManagedPolicyProvider(); |
| 45 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); |
| 46 |
| 47 private: |
| 48 // Updates the policy provider with a new refresh rate value. |
| 49 void UpdatePolicyRefreshRate(); |
| 50 |
| 51 // NotificationObserver overrides. |
| 52 virtual void Observe(NotificationType type, |
| 53 const NotificationSource& source, |
| 54 const NotificationDetails& details); |
| 55 |
| 56 // The pref service that controls the refresh rate. |
| 57 PrefService* prefs_; |
| 58 |
| 59 // Tracks the pref value for the policy refresh rate. |
| 60 IntegerPrefMember policy_refresh_rate_; |
| 61 |
| 62 // Cloud policy infrastructure stuff. |
| 63 scoped_ptr<DeviceManagementService> device_management_service_; |
| 64 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; |
| 65 scoped_ptr<CloudPolicyCache> cloud_policy_cache_; |
| 66 scoped_ptr<CloudPolicyClient> cloud_policy_client_; |
| 67 }; |
| 68 |
| 69 } // namespace policy |
| 70 |
| 71 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_CONTEXT_H_ |
OLD | NEW |