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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit 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 "content/public/browser/notification_observer.h" 10 #include "base/prefs/public/pref_observer.h"
11 #include "net/base/network_change_notifier.h" 11 #include "net/base/network_change_notifier.h"
12 12
13 class PrefService; 13 class PrefService;
14 14
15 namespace policy { 15 namespace policy {
16 16
17 class CloudPolicyCacheBase; 17 class CloudPolicyCacheBase;
18 class CloudPolicyController; 18 class CloudPolicyController;
19 class CloudPolicyDataStore; 19 class CloudPolicyDataStore;
20 class DeviceManagementService; 20 class DeviceManagementService;
21 class DeviceTokenFetcher; 21 class DeviceTokenFetcher;
22 class PolicyNotifier; 22 class PolicyNotifier;
23 23
24 // This class is a container for the infrastructure required to support cloud 24 // 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 25 // policy. It glues together the backend, the policy controller and manages the
26 // life cycle of the policy providers. 26 // life cycle of the policy providers.
27 class CloudPolicySubsystem 27 class CloudPolicySubsystem
28 : public content::NotificationObserver, 28 : public PrefObserver,
29 public net::NetworkChangeNotifier::IPAddressObserver { 29 public net::NetworkChangeNotifier::IPAddressObserver {
30 public: 30 public:
31 enum PolicySubsystemState { 31 enum PolicySubsystemState {
32 UNENROLLED, // No enrollment attempt has been performed yet. 32 UNENROLLED, // No enrollment attempt has been performed yet.
33 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token. 33 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token.
34 UNMANAGED, // This device is unmanaged. 34 UNMANAGED, // This device is unmanaged.
35 NETWORK_ERROR, // A network error occurred, retrying makes sense. 35 NETWORK_ERROR, // A network error occurred, retrying makes sense.
36 LOCAL_ERROR, // Retrying is futile. 36 LOCAL_ERROR, // Retrying is futile.
37 TOKEN_FETCHED, // Device has been successfully registered. 37 TOKEN_FETCHED, // Device has been successfully registered.
38 SUCCESS // Policy has been fetched successfully and is in effect. 38 SUCCESS // Policy has been fetched successfully and is in effect.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // Returns a weak pointer to this subsystem's PolicyNotifier. 125 // Returns a weak pointer to this subsystem's PolicyNotifier.
126 PolicyNotifier* notifier() { 126 PolicyNotifier* notifier() {
127 return notifier_.get(); 127 return notifier_.get();
128 } 128 }
129 129
130 // Factory methods that may be overridden in tests. 130 // Factory methods that may be overridden in tests.
131 virtual void CreateDeviceTokenFetcher(); 131 virtual void CreateDeviceTokenFetcher();
132 virtual void CreateCloudPolicyController(); 132 virtual void CreateCloudPolicyController();
133 133
134 // content::NotificationObserver overrides. 134 // PrefObserver overrides.
135 virtual void Observe(int type, 135 virtual void OnPreferenceChanged(PrefServiceBase* service,
136 const content::NotificationSource& source, 136 const std::string& pref_name) OVERRIDE;
137 const content::NotificationDetails& details) OVERRIDE;
138 137
139 // net::NetworkChangeNotifier::IPAddressObserver: 138 // net::NetworkChangeNotifier::IPAddressObserver:
140 virtual void OnIPAddressChanged() OVERRIDE; 139 virtual void OnIPAddressChanged() OVERRIDE;
141 140
142 // Name of the preference to read the refresh rate from. 141 // Name of the preference to read the refresh rate from.
143 const char* refresh_pref_name_; 142 const char* refresh_pref_name_;
144 143
145 PrefChangeRegistrar pref_change_registrar_; 144 PrefChangeRegistrar pref_change_registrar_;
146 145
147 CloudPolicyDataStore* data_store_; 146 CloudPolicyDataStore* data_store_;
148 147
149 // Cloud policy infrastructure stuff. 148 // Cloud policy infrastructure stuff.
150 scoped_ptr<PolicyNotifier> notifier_; 149 scoped_ptr<PolicyNotifier> notifier_;
151 scoped_ptr<DeviceManagementService> device_management_service_; 150 scoped_ptr<DeviceManagementService> device_management_service_;
152 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; 151 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_;
153 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; 152 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_;
154 scoped_ptr<CloudPolicyController> cloud_policy_controller_; 153 scoped_ptr<CloudPolicyController> cloud_policy_controller_;
155 154
156 std::string device_management_url_; 155 std::string device_management_url_;
157 156
158 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); 157 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem);
159 }; 158 };
160 159
161 } // namespace policy 160 } // namespace policy
162 161
163 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 162 #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