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/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" | 18 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" |
| 19 #include "chromeos/cert_loader.h" |
19 #include "chromeos/dbus/session_manager_client.h" | 20 #include "chromeos/dbus/session_manager_client.h" |
20 | 21 |
21 namespace crypto { | 22 namespace crypto { |
22 class RSAPrivateKey; | 23 class RSAPrivateKey; |
23 } | 24 } |
24 | 25 |
25 namespace enterprise_management { | 26 namespace enterprise_management { |
26 class ChromeDeviceSettingsProto; | 27 class ChromeDeviceSettingsProto; |
27 class PolicyData; | 28 class PolicyData; |
28 class PolicyFetchResponse; | 29 class PolicyFetchResponse; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // signature generated by a key in the device owner's possession. Key and | 65 // signature generated by a key in the device owner's possession. Key and |
65 // settings are brokered by the session_manager daemon. | 66 // settings are brokered by the session_manager daemon. |
66 // | 67 // |
67 // The purpose of DeviceSettingsService is to keep track of the current key and | 68 // The purpose of DeviceSettingsService is to keep track of the current key and |
68 // settings blob. For reading and writing device settings, use CrosSettings | 69 // settings blob. For reading and writing device settings, use CrosSettings |
69 // instead, which provides a high-level interface that allows for manipulation | 70 // instead, which provides a high-level interface that allows for manipulation |
70 // of individual settings. | 71 // of individual settings. |
71 // | 72 // |
72 // DeviceSettingsService generates notifications for key and policy update | 73 // DeviceSettingsService generates notifications for key and policy update |
73 // events so interested parties can reload state as appropriate. | 74 // events so interested parties can reload state as appropriate. |
74 class DeviceSettingsService : public SessionManagerClient::Observer { | 75 class DeviceSettingsService : public SessionManagerClient::Observer, |
| 76 public CertLoader::Observer { |
75 public: | 77 public: |
76 // Indicates ownership status of the device. | 78 // Indicates ownership status of the device. |
77 enum OwnershipStatus { | 79 enum OwnershipStatus { |
78 // Listed in upgrade order. | 80 // Listed in upgrade order. |
79 OWNERSHIP_UNKNOWN = 0, | 81 OWNERSHIP_UNKNOWN = 0, |
80 OWNERSHIP_NONE, | 82 OWNERSHIP_NONE, |
81 OWNERSHIP_TAKEN | 83 OWNERSHIP_TAKEN |
82 }; | 84 }; |
83 | 85 |
84 typedef base::Callback<void(OwnershipStatus, bool)> OwnershipStatusCallback; | 86 typedef base::Callback<void(OwnershipStatus, bool)> OwnershipStatusCallback; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 183 |
182 // Adds an observer. | 184 // Adds an observer. |
183 void AddObserver(Observer* observer); | 185 void AddObserver(Observer* observer); |
184 // Removes an observer. | 186 // Removes an observer. |
185 void RemoveObserver(Observer* observer); | 187 void RemoveObserver(Observer* observer); |
186 | 188 |
187 // SessionManagerClient::Observer: | 189 // SessionManagerClient::Observer: |
188 virtual void OwnerKeySet(bool success) OVERRIDE; | 190 virtual void OwnerKeySet(bool success) OVERRIDE; |
189 virtual void PropertyChangeComplete(bool success) OVERRIDE; | 191 virtual void PropertyChangeComplete(bool success) OVERRIDE; |
190 | 192 |
| 193 // CertLoader::Observer: |
| 194 virtual void OnCertificatesLoaded(const net::CertificateList& cert_list, |
| 195 bool initial_load) OVERRIDE; |
| 196 |
191 private: | 197 private: |
192 // Enqueues a new operation. Takes ownership of |operation| and starts it | 198 // Enqueues a new operation. Takes ownership of |operation| and starts it |
193 // right away if there is no active operation currently. | 199 // right away if there is no active operation currently. |
194 void Enqueue(SessionManagerOperation* operation); | 200 void Enqueue(SessionManagerOperation* operation); |
195 | 201 |
196 // Enqueues a load operation. | 202 // Enqueues a load operation. |
197 void EnqueueLoad(bool force_key_load); | 203 void EnqueueLoad(bool force_key_load); |
198 | 204 |
199 // Makes sure there's a reload operation so changes to the settings (and key, | 205 // 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. | 206 // in case force_key_load is set) are getting picked up. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 ScopedTestDeviceSettingsService(); | 249 ScopedTestDeviceSettingsService(); |
244 ~ScopedTestDeviceSettingsService(); | 250 ~ScopedTestDeviceSettingsService(); |
245 | 251 |
246 private: | 252 private: |
247 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 253 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
248 }; | 254 }; |
249 | 255 |
250 } // namespace chromeos | 256 } // namespace chromeos |
251 | 257 |
252 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 258 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |