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

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

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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 "net/base/network_change_notifier.h" 10 #include "net/base/network_change_notifier.h"
11 11
12 class PrefServiceSimple; 12 class PrefServiceSimple;
13 13
14 namespace policy { 14 namespace policy {
15 15
16 class CloudPolicyCacheBase; 16 class CloudPolicyCacheBase;
17 class CloudPolicyController; 17 class CloudPolicyController;
18 class CloudPolicyDataStore; 18 class CloudPolicyDataStore;
19 class DeviceManagementService; 19 class DeviceManagementService;
20 class DeviceTokenFetcher; 20 class DeviceTokenFetcher;
21 class PolicyNotifier; 21 class PolicyNotifier;
22 22
23 // 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
24 // 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
25 // life cycle of the policy providers. 25 // life cycle of the policy providers.
26 class CloudPolicySubsystem 26 class CloudPolicySubsystem
27 : public net::NetworkChangeNotifier::IPAddressObserver { 27 : public net::NetworkChangeNotifier::NetworkChangeObserver {
28 public: 28 public:
29 enum PolicySubsystemState { 29 enum PolicySubsystemState {
30 UNENROLLED, // No enrollment attempt has been performed yet. 30 UNENROLLED, // No enrollment attempt has been performed yet.
31 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token. 31 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token.
32 UNMANAGED, // This device is unmanaged. 32 UNMANAGED, // This device is unmanaged.
33 NETWORK_ERROR, // A network error occurred, retrying makes sense. 33 NETWORK_ERROR, // A network error occurred, retrying makes sense.
34 LOCAL_ERROR, // Retrying is futile. 34 LOCAL_ERROR, // Retrying is futile.
35 TOKEN_FETCHED, // Device has been successfully registered. 35 TOKEN_FETCHED, // Device has been successfully registered.
36 SUCCESS // Policy has been fetched successfully and is in effect. 36 SUCCESS // Policy has been fetched successfully and is in effect.
37 }; 37 };
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void OnRefreshPrefChanged(); 134 void OnRefreshPrefChanged();
135 135
136 // net::NetworkChangeNotifier::IPAddressObserver: 136 // net::NetworkChangeNotifier::NetworkChangeObserver:
137 virtual void OnIPAddressChanged() OVERRIDE; 137 virtual void OnNetworkChanged(
138 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
138 139
139 // Name of the preference to read the refresh rate from. 140 // Name of the preference to read the refresh rate from.
140 const char* refresh_pref_name_; 141 const char* refresh_pref_name_;
141 142
142 PrefChangeRegistrar pref_change_registrar_; 143 PrefChangeRegistrar pref_change_registrar_;
143 144
144 CloudPolicyDataStore* data_store_; 145 CloudPolicyDataStore* data_store_;
145 146
146 // Cloud policy infrastructure stuff. 147 // Cloud policy infrastructure stuff.
147 scoped_ptr<PolicyNotifier> notifier_; 148 scoped_ptr<PolicyNotifier> notifier_;
148 scoped_ptr<DeviceManagementService> device_management_service_; 149 scoped_ptr<DeviceManagementService> device_management_service_;
149 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; 150 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_;
150 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; 151 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_;
151 scoped_ptr<CloudPolicyController> cloud_policy_controller_; 152 scoped_ptr<CloudPolicyController> cloud_policy_controller_;
152 153
153 std::string device_management_url_; 154 std::string device_management_url_;
154 155
155 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); 156 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem);
156 }; 157 };
157 158
158 } // namespace policy 159 } // namespace policy
159 160
160 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 161 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698