| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CLOUD_POLICY_SUBSYSTEM_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
| 11 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 11 #include "content/common/notification_observer.h" | 12 #include "content/common/notification_observer.h" |
| 12 #include "net/base/network_change_notifier.h" | 13 #include "net/base/network_change_notifier.h" |
| 13 | 14 |
| 14 class PrefService; | 15 class PrefService; |
| 15 | 16 |
| 16 namespace policy { | 17 namespace policy { |
| 17 | 18 |
| 18 class CloudPolicyCacheBase; | 19 class CloudPolicyCacheBase; |
| 19 class CloudPolicyController; | 20 class CloudPolicyController; |
| 20 class CloudPolicyIdentityStrategy; | 21 class CloudPolicyIdentityStrategy; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar); | 69 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 CloudPolicySubsystem(CloudPolicyIdentityStrategy* identity_strategy, | 72 CloudPolicySubsystem(CloudPolicyIdentityStrategy* identity_strategy, |
| 72 CloudPolicyCacheBase* policy_cache); | 73 CloudPolicyCacheBase* policy_cache); |
| 73 virtual ~CloudPolicySubsystem(); | 74 virtual ~CloudPolicySubsystem(); |
| 74 | 75 |
| 75 // net::NetworkChangeNotifier::IPAddressObserver: | 76 // net::NetworkChangeNotifier::IPAddressObserver: |
| 76 virtual void OnIPAddressChanged() OVERRIDE; | 77 virtual void OnIPAddressChanged() OVERRIDE; |
| 77 | 78 |
| 78 // Initializes the subsystem.The first network request will only be made | 79 // Initializes the subsystem. The first network request will only be made |
| 79 // after |delay_milliseconds|. | 80 // after |delay_milliseconds|. |
| 80 void Initialize(PrefService* prefs, int64 delay_milliseconds); | 81 void Initialize(const char* refresh_pref_name, int64 delay_milliseconds); |
| 81 | 82 |
| 82 // Shuts the subsystem down. This must be called before threading and network | 83 // Shuts the subsystem down. This must be called before threading and network |
| 83 // infrastructure goes away. | 84 // infrastructure goes away. |
| 84 void Shutdown(); | 85 void Shutdown(); |
| 85 | 86 |
| 86 // Returns the externally visible state and corresponding error details. | 87 // Returns the externally visible state and corresponding error details. |
| 87 PolicySubsystemState state(); | 88 PolicySubsystemState state(); |
| 88 ErrorDetails error_details(); | 89 ErrorDetails error_details(); |
| 89 | 90 |
| 90 // Stops all auto-retrying error handling behavior inside the policy | 91 // Stops all auto-retrying error handling behavior inside the policy |
| 91 // subsystem. | 92 // subsystem. |
| 92 void StopAutoRetry(); | 93 void StopAutoRetry(); |
| 93 | 94 |
| 94 ConfigurationPolicyProvider* GetManagedPolicyProvider(); | 95 ConfigurationPolicyProvider* GetManagedPolicyProvider(); |
| 95 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); | 96 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); |
| 96 | 97 |
| 97 // Registers cloud policy related prefs. | 98 // Registers cloud policy related prefs. |
| 98 static void RegisterPrefs(PrefService* pref_service); | 99 static void RegisterPrefs(PrefService* pref_service); |
| 99 | 100 |
| 100 // Schedule initialization of the policy backend service. | 101 // Schedule initialization of the policy backend service. |
| 101 void ScheduleServiceInitialization(int64 delay_milliseconds); | 102 void ScheduleServiceInitialization(int64 delay_milliseconds); |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 // Updates the policy controller with a new refresh rate value. | 105 // Updates the policy controller with a new refresh rate value. |
| 105 void UpdatePolicyRefreshRate(); | 106 void UpdatePolicyRefreshRate(int64 refresh_rate); |
| 106 | 107 |
| 107 // Returns a weak pointer to this subsystem's PolicyNotifier. | 108 // Returns a weak pointer to this subsystem's PolicyNotifier. |
| 108 PolicyNotifier* notifier() { | 109 PolicyNotifier* notifier() { |
| 109 return notifier_.get(); | 110 return notifier_.get(); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // NotificationObserver overrides. | 113 // NotificationObserver overrides. |
| 113 virtual void Observe(NotificationType type, | 114 virtual void Observe(NotificationType type, |
| 114 const NotificationSource& source, | 115 const NotificationSource& source, |
| 115 const NotificationDetails& details); | 116 const NotificationDetails& details); |
| 116 | 117 |
| 117 // The pref service that controls the refresh rate. | 118 // Name of the preference to read the refresh rate from. |
| 118 PrefService* prefs_; | 119 const char* refresh_pref_name_; |
| 119 | 120 |
| 120 // Tracks the pref value for the policy refresh rate. | 121 PrefChangeRegistrar pref_change_registrar_; |
| 121 IntegerPrefMember policy_refresh_rate_; | |
| 122 | 122 |
| 123 // Weak reference to pass on to |cloud_policy_controller_| on creation. | 123 // Weak reference to pass on to |cloud_policy_controller_| on creation. |
| 124 CloudPolicyIdentityStrategy* identity_strategy_; | 124 CloudPolicyIdentityStrategy* identity_strategy_; |
| 125 | 125 |
| 126 // Cloud policy infrastructure stuff. | 126 // Cloud policy infrastructure stuff. |
| 127 scoped_ptr<PolicyNotifier> notifier_; | 127 scoped_ptr<PolicyNotifier> notifier_; |
| 128 scoped_ptr<DeviceManagementService> device_management_service_; | 128 scoped_ptr<DeviceManagementService> device_management_service_; |
| 129 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; | 129 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; |
| 130 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; | 130 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; |
| 131 scoped_ptr<CloudPolicyController> cloud_policy_controller_; | 131 scoped_ptr<CloudPolicyController> cloud_policy_controller_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); | 133 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace policy | 136 } // namespace policy |
| 137 | 137 |
| 138 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ | 138 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
| OLD | NEW |