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/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 19 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
20 #include "chromeos/dbus/session_manager_client.h" | 20 #include "chromeos/dbus/session_manager_client.h" |
21 #include "components/ownership/owner_settings_service.h" | 21 #include "components/ownership/owner_settings_service.h" |
22 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 22 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
| 23 #include "components/user_manager/user_id.h" |
23 #include "crypto/scoped_nss_types.h" | 24 #include "crypto/scoped_nss_types.h" |
24 #include "policy/proto/device_management_backend.pb.h" | 25 #include "policy/proto/device_management_backend.pb.h" |
25 | 26 |
26 namespace crypto { | 27 namespace crypto { |
27 class RSAPrivateKey; | 28 class RSAPrivateKey; |
28 } | 29 } |
29 | 30 |
30 namespace ownership { | 31 namespace ownership { |
31 class OwnerKeyUtil; | 32 class OwnerKeyUtil; |
32 class PublicKey; | 33 class PublicKey; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // OwnerSettingsService. | 154 // OwnerSettingsService. |
154 bool HasPrivateOwnerKey(); | 155 bool HasPrivateOwnerKey(); |
155 | 156 |
156 // Sets the identity of the user that's interacting with the service. This is | 157 // Sets the identity of the user that's interacting with the service. This is |
157 // relevant only for writing settings through SignAndStore(). | 158 // relevant only for writing settings through SignAndStore(). |
158 // | 159 // |
159 // TODO (ygorshenin@, crbug.com/433840): get rid of the method when | 160 // TODO (ygorshenin@, crbug.com/433840): get rid of the method when |
160 // write path for device settings will be removed from | 161 // write path for device settings will be removed from |
161 // DeviceSettingsProvider and all existing clients will be switched | 162 // DeviceSettingsProvider and all existing clients will be switched |
162 // to OwnerSettingsServiceChromeOS. | 163 // to OwnerSettingsServiceChromeOS. |
163 void InitOwner(const std::string& username, | 164 void InitOwner(const user_manager::UserID& user_id, |
164 const base::WeakPtr<ownership::OwnerSettingsService>& | 165 const base::WeakPtr<ownership::OwnerSettingsService>& |
165 owner_settings_service); | 166 owner_settings_service); |
166 | 167 |
167 const std::string& GetUsername() const; | 168 const user_manager::UserID& GetUserID() const; |
168 | 169 |
169 ownership::OwnerSettingsService* GetOwnerSettingsService() const; | 170 ownership::OwnerSettingsService* GetOwnerSettingsService() const; |
170 | 171 |
171 // Adds an observer. | 172 // Adds an observer. |
172 void AddObserver(Observer* observer); | 173 void AddObserver(Observer* observer); |
173 // Removes an observer. | 174 // Removes an observer. |
174 void RemoveObserver(Observer* observer); | 175 void RemoveObserver(Observer* observer); |
175 | 176 |
176 // SessionManagerClient::Observer: | 177 // SessionManagerClient::Observer: |
177 void OwnerKeySet(bool success) override; | 178 void OwnerKeySet(bool success) override; |
(...skipping 25 matching lines...) Expand all Loading... |
203 // Updates status and invokes the callback immediately. | 204 // Updates status and invokes the callback immediately. |
204 void HandleError(Status status, const base::Closure& callback); | 205 void HandleError(Status status, const base::Closure& callback); |
205 | 206 |
206 SessionManagerClient* session_manager_client_; | 207 SessionManagerClient* session_manager_client_; |
207 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; | 208 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; |
208 | 209 |
209 Status store_status_; | 210 Status store_status_; |
210 | 211 |
211 std::vector<OwnershipStatusCallback> pending_ownership_status_callbacks_; | 212 std::vector<OwnershipStatusCallback> pending_ownership_status_callbacks_; |
212 | 213 |
213 std::string username_; | 214 user_manager::UserID user_id_; |
214 scoped_refptr<ownership::PublicKey> public_key_; | 215 scoped_refptr<ownership::PublicKey> public_key_; |
215 base::WeakPtr<ownership::OwnerSettingsService> owner_settings_service_; | 216 base::WeakPtr<ownership::OwnerSettingsService> owner_settings_service_; |
216 | 217 |
217 scoped_ptr<enterprise_management::PolicyData> policy_data_; | 218 scoped_ptr<enterprise_management::PolicyData> policy_data_; |
218 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; | 219 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; |
219 | 220 |
220 // The queue of pending operations. The first operation on the queue is | 221 // The queue of pending operations. The first operation on the queue is |
221 // currently active; it gets removed and destroyed once it completes. | 222 // currently active; it gets removed and destroyed once it completes. |
222 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; | 223 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; |
223 | 224 |
(...skipping 14 matching lines...) Expand all Loading... |
238 ScopedTestDeviceSettingsService(); | 239 ScopedTestDeviceSettingsService(); |
239 ~ScopedTestDeviceSettingsService(); | 240 ~ScopedTestDeviceSettingsService(); |
240 | 241 |
241 private: | 242 private: |
242 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 243 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
243 }; | 244 }; |
244 | 245 |
245 } // namespace chromeos | 246 } // namespace chromeos |
246 | 247 |
247 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 248 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |