Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: chrome/browser/policy/cloud_policy_subsystem.h

Issue 11414083: Remove PrefObserver usage, batch 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to sort-of good revision (r169014). Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/public/pref_change_registrar.h" 9 #include "base/prefs/public/pref_change_registrar.h"
10 #include "base/prefs/public/pref_observer.h"
11 #include "net/base/network_change_notifier.h" 10 #include "net/base/network_change_notifier.h"
12 11
13 class PrefService; 12 class PrefService;
14 13
15 namespace policy { 14 namespace policy {
16 15
17 class CloudPolicyCacheBase; 16 class CloudPolicyCacheBase;
18 class CloudPolicyController; 17 class CloudPolicyController;
19 class CloudPolicyDataStore; 18 class CloudPolicyDataStore;
20 class DeviceManagementService; 19 class DeviceManagementService;
21 class DeviceTokenFetcher; 20 class DeviceTokenFetcher;
22 class PolicyNotifier; 21 class PolicyNotifier;
23 22
24 // This class is a container for the infrastructure required to support cloud 23 // This class is a container for the infrastructure required to support cloud
25 // policy. It glues together the backend, the policy controller and manages the 24 // policy. It glues together the backend, the policy controller and manages the
26 // life cycle of the policy providers. 25 // life cycle of the policy providers.
27 class CloudPolicySubsystem 26 class CloudPolicySubsystem
28 : public PrefObserver, 27 : public net::NetworkChangeNotifier::IPAddressObserver {
29 public net::NetworkChangeNotifier::IPAddressObserver {
30 public: 28 public:
31 enum PolicySubsystemState { 29 enum PolicySubsystemState {
32 UNENROLLED, // No enrollment attempt has been performed yet. 30 UNENROLLED, // No enrollment attempt has been performed yet.
33 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token. 31 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token.
34 UNMANAGED, // This device is unmanaged. 32 UNMANAGED, // This device is unmanaged.
35 NETWORK_ERROR, // A network error occurred, retrying makes sense. 33 NETWORK_ERROR, // A network error occurred, retrying makes sense.
36 LOCAL_ERROR, // Retrying is futile. 34 LOCAL_ERROR, // Retrying is futile.
37 TOKEN_FETCHED, // Device has been successfully registered. 35 TOKEN_FETCHED, // Device has been successfully registered.
38 SUCCESS // Policy has been fetched successfully and is in effect. 36 SUCCESS // Policy has been fetched successfully and is in effect.
39 }; 37 };
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 122
125 // Returns a weak pointer to this subsystem's PolicyNotifier. 123 // Returns a weak pointer to this subsystem's PolicyNotifier.
126 PolicyNotifier* notifier() { 124 PolicyNotifier* notifier() {
127 return notifier_.get(); 125 return notifier_.get();
128 } 126 }
129 127
130 // Factory methods that may be overridden in tests. 128 // Factory methods that may be overridden in tests.
131 virtual void CreateDeviceTokenFetcher(); 129 virtual void CreateDeviceTokenFetcher();
132 virtual void CreateCloudPolicyController(); 130 virtual void CreateCloudPolicyController();
133 131
134 // PrefObserver overrides. 132 void OnRefreshPrefChanged();
135 virtual void OnPreferenceChanged(PrefServiceBase* service,
136 const std::string& pref_name) OVERRIDE;
137 133
138 // net::NetworkChangeNotifier::IPAddressObserver: 134 // net::NetworkChangeNotifier::IPAddressObserver:
139 virtual void OnIPAddressChanged() OVERRIDE; 135 virtual void OnIPAddressChanged() OVERRIDE;
140 136
141 // Name of the preference to read the refresh rate from. 137 // Name of the preference to read the refresh rate from.
142 const char* refresh_pref_name_; 138 const char* refresh_pref_name_;
143 139
144 PrefChangeRegistrar pref_change_registrar_; 140 PrefChangeRegistrar pref_change_registrar_;
145 141
146 CloudPolicyDataStore* data_store_; 142 CloudPolicyDataStore* data_store_;
147 143
148 // Cloud policy infrastructure stuff. 144 // Cloud policy infrastructure stuff.
149 scoped_ptr<PolicyNotifier> notifier_; 145 scoped_ptr<PolicyNotifier> notifier_;
150 scoped_ptr<DeviceManagementService> device_management_service_; 146 scoped_ptr<DeviceManagementService> device_management_service_;
151 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; 147 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_;
152 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; 148 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_;
153 scoped_ptr<CloudPolicyController> cloud_policy_controller_; 149 scoped_ptr<CloudPolicyController> cloud_policy_controller_;
154 150
155 std::string device_management_url_; 151 std::string device_management_url_;
156 152
157 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); 153 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem);
158 }; 154 };
159 155
160 } // namespace policy 156 } // namespace policy
161 157
162 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 158 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_refresh_scheduler.cc ('k') | chrome/browser/policy/cloud_policy_subsystem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698