OLD | NEW |
---|---|
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_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" | 17 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" |
18 #include "chromeos/dbus/session_manager_client.h" | 18 #include "chromeos/dbus/session_manager_client.h" |
19 | 19 |
20 namespace base { | |
21 template <typename T> struct DefaultLazyInstanceTraits; | |
22 } | |
23 | |
24 namespace crypto { | 20 namespace crypto { |
25 class RSAPrivateKey; | 21 class RSAPrivateKey; |
26 } | 22 } |
27 | 23 |
28 namespace enterprise_management { | 24 namespace enterprise_management { |
29 class ChromeDeviceSettingsProto; | 25 class ChromeDeviceSettingsProto; |
30 class PolicyData; | 26 class PolicyData; |
31 class PolicyFetchResponse; | 27 class PolicyFetchResponse; |
32 } | 28 } |
33 | 29 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 public: | 99 public: |
104 virtual ~Observer(); | 100 virtual ~Observer(); |
105 | 101 |
106 // Indicates device ownership status changes. | 102 // Indicates device ownership status changes. |
107 virtual void OwnershipStatusChanged() = 0; | 103 virtual void OwnershipStatusChanged() = 0; |
108 | 104 |
109 // Gets call after updates to the device settings. | 105 // Gets call after updates to the device settings. |
110 virtual void DeviceSettingsUpdated() = 0; | 106 virtual void DeviceSettingsUpdated() = 0; |
111 }; | 107 }; |
112 | 108 |
113 // Creates a device settings service instance. This is meant for unit tests, | 109 // Class factory. |
114 // production code uses the singleton returned by Get() below. | 110 static void Initialize(); |
115 DeviceSettingsService(); | 111 static void Shutdown(); |
116 ~DeviceSettingsService(); | |
117 | |
118 // Returns the singleton instance. | |
119 static DeviceSettingsService* Get(); | 112 static DeviceSettingsService* Get(); |
120 | 113 |
121 // To be called on startup once threads are initialized and DBus is ready. | 114 // To be called on startup once threads are initialized and DBus is ready. |
122 void Initialize(SessionManagerClient* session_manager_client, | 115 void InitializeSessionManager(SessionManagerClient* session_manager_client, |
Mattias Nissler (ping if slow)
2013/04/16 16:09:51
This function name is unfortunate, the function do
stevenjb
2013/04/16 16:49:43
->Set
| |
123 scoped_refptr<OwnerKeyUtil> owner_key_util); | 116 scoped_refptr<OwnerKeyUtil> owner_key_util); |
124 | 117 |
125 // Prevents the service from making further calls to session_manager_client | 118 // Prevents the service from making further calls to session_manager_client |
126 // and stops any pending operations. | 119 // and stops any pending operations. |
127 void Shutdown(); | 120 void ShutdownSessionManager(); |
Mattias Nissler (ping if slow)
2013/04/16 16:09:51
ditto
stevenjb
2013/04/16 16:49:43
->Unset
| |
128 | 121 |
129 // Returns the currently active device settings. Returns NULL if the device | 122 // Returns the currently active device settings. Returns NULL if the device |
130 // settings have not been retrieved from session_manager yet. | 123 // settings have not been retrieved from session_manager yet. |
131 const enterprise_management::PolicyData* policy_data() { | 124 const enterprise_management::PolicyData* policy_data() { |
132 return policy_data_.get(); | 125 return policy_data_.get(); |
133 } | 126 } |
134 const enterprise_management::ChromeDeviceSettingsProto* | 127 const enterprise_management::ChromeDeviceSettingsProto* |
135 device_settings() const { | 128 device_settings() const { |
136 return device_settings_.get(); | 129 return device_settings_.get(); |
137 } | 130 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 // Adds an observer. | 175 // Adds an observer. |
183 void AddObserver(Observer* observer); | 176 void AddObserver(Observer* observer); |
184 // Removes an observer. | 177 // Removes an observer. |
185 void RemoveObserver(Observer* observer); | 178 void RemoveObserver(Observer* observer); |
186 | 179 |
187 // SessionManagerClient::Observer: | 180 // SessionManagerClient::Observer: |
188 virtual void OwnerKeySet(bool success) OVERRIDE; | 181 virtual void OwnerKeySet(bool success) OVERRIDE; |
189 virtual void PropertyChangeComplete(bool success) OVERRIDE; | 182 virtual void PropertyChangeComplete(bool success) OVERRIDE; |
190 | 183 |
191 private: | 184 private: |
185 DeviceSettingsService(); | |
186 virtual ~DeviceSettingsService(); | |
Mattias Nissler (ping if slow)
2013/04/16 16:09:51
Why? Nothing is virtual here.
stevenjb
2013/04/16 16:49:43
SessionManagerClient::Observer methods
Mattias Nissler (ping if slow)
2013/04/16 18:04:13
Ah, good point.
| |
187 | |
192 // Enqueues a new operation. Takes ownership of |operation| and starts it | 188 // Enqueues a new operation. Takes ownership of |operation| and starts it |
193 // right away if there is no active operation currently. | 189 // right away if there is no active operation currently. |
194 void Enqueue(SessionManagerOperation* operation); | 190 void Enqueue(SessionManagerOperation* operation); |
195 | 191 |
196 // Enqueues a load operation. | 192 // Enqueues a load operation. |
197 void EnqueueLoad(bool force_key_load); | 193 void EnqueueLoad(bool force_key_load); |
198 | 194 |
199 // Makes sure there's a reload operation so changes to the settings (and key, | 195 // Makes sure there's a reload operation so changes to the settings (and key, |
200 // in case force_key_load is set) are getting picked up. | 196 // in case force_key_load is set) are getting picked up. |
201 void EnsureReload(bool force_key_load); | 197 void EnsureReload(bool force_key_load); |
(...skipping 30 matching lines...) Expand all Loading... | |
232 | 228 |
233 // For recoverable load errors how many retries are left before we give up. | 229 // For recoverable load errors how many retries are left before we give up. |
234 int load_retries_left_; | 230 int load_retries_left_; |
235 | 231 |
236 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); | 232 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); |
237 }; | 233 }; |
238 | 234 |
239 } // namespace chromeos | 235 } // namespace chromeos |
240 | 236 |
241 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 237 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |