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 "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "chromeos/dbus/session_manager_client.h" | 19 #include "chromeos/dbus/session_manager_client.h" |
20 #include "chromeos/tpm_token_loader.h" | 20 #include "chromeos/tpm_token_loader.h" |
21 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
| 22 #include "crypto/scoped_nss_types.h" |
22 #include "policy/proto/device_management_backend.pb.h" | 23 #include "policy/proto/device_management_backend.pb.h" |
23 | 24 |
24 namespace crypto { | 25 namespace crypto { |
25 class RSAPrivateKey; | 26 class RSAPrivateKey; |
26 } | 27 } |
27 | 28 |
28 namespace enterprise_management { | 29 namespace enterprise_management { |
29 class ChromeDeviceSettingsProto; | 30 class ChromeDeviceSettingsProto; |
30 } | 31 } |
31 | 32 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Checks whether we have the private owner key. | 193 // Checks whether we have the private owner key. |
193 bool HasPrivateOwnerKey(); | 194 bool HasPrivateOwnerKey(); |
194 | 195 |
195 // Determines whether the current user is the owner. The callback is | 196 // Determines whether the current user is the owner. The callback is |
196 // guaranteed not to be called before it is possible to determine if the | 197 // guaranteed not to be called before it is possible to determine if the |
197 // current user is the owner (by testing existence of the private owner key). | 198 // current user is the owner (by testing existence of the private owner key). |
198 void IsCurrentUserOwnerAsync(const IsCurrentUserOwnerCallback& callback); | 199 void IsCurrentUserOwnerAsync(const IsCurrentUserOwnerCallback& callback); |
199 | 200 |
200 // Sets the identity of the user that's interacting with the service. This is | 201 // Sets the identity of the user that's interacting with the service. This is |
201 // relevant only for writing settings through SignAndStore(). | 202 // relevant only for writing settings through SignAndStore(). |
202 void SetUsername(const std::string& username); | 203 void InitOwner(const std::string& username, crypto::ScopedPK11Slot slot); |
203 const std::string& GetUsername() const; | 204 const std::string& GetUsername() const; |
204 | 205 |
205 // Adds an observer. | 206 // Adds an observer. |
206 void AddObserver(Observer* observer); | 207 void AddObserver(Observer* observer); |
207 // Removes an observer. | 208 // Removes an observer. |
208 void RemoveObserver(Observer* observer); | 209 void RemoveObserver(Observer* observer); |
209 | 210 |
210 // SessionManagerClient::Observer: | 211 // SessionManagerClient::Observer: |
211 virtual void OwnerKeySet(bool success) OVERRIDE; | 212 virtual void OwnerKeySet(bool success) OVERRIDE; |
212 virtual void PropertyChangeComplete(bool success) OVERRIDE; | 213 virtual void PropertyChangeComplete(bool success) OVERRIDE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 SessionManagerClient* session_manager_client_; | 255 SessionManagerClient* session_manager_client_; |
255 scoped_refptr<OwnerKeyUtil> owner_key_util_; | 256 scoped_refptr<OwnerKeyUtil> owner_key_util_; |
256 | 257 |
257 Status store_status_; | 258 Status store_status_; |
258 | 259 |
259 std::vector<OwnershipStatusCallback> pending_ownership_status_callbacks_; | 260 std::vector<OwnershipStatusCallback> pending_ownership_status_callbacks_; |
260 std::vector<IsCurrentUserOwnerCallback> | 261 std::vector<IsCurrentUserOwnerCallback> |
261 pending_is_current_user_owner_callbacks_; | 262 pending_is_current_user_owner_callbacks_; |
262 | 263 |
263 std::string username_; | 264 std::string username_; |
| 265 crypto::ScopedPK11Slot slot_; |
264 scoped_refptr<OwnerKey> owner_key_; | 266 scoped_refptr<OwnerKey> owner_key_; |
265 // Whether TPM token still needs to be initialized. | 267 // Whether TPM token still needs to be initialized. |
266 bool waiting_for_tpm_token_; | 268 bool waiting_for_tpm_token_; |
267 // Whether TPM token was ready when the current owner key was set. | 269 // Whether TPM token was ready when the current owner key was set. |
268 // Implies that the current user is owner iff the private owner key is set. | 270 // Implies that the current user is owner iff the private owner key is set. |
269 bool owner_key_loaded_with_tpm_token_; | 271 bool owner_key_loaded_with_tpm_token_; |
270 | 272 |
271 scoped_ptr<enterprise_management::PolicyData> policy_data_; | 273 scoped_ptr<enterprise_management::PolicyData> policy_data_; |
272 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; | 274 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; |
273 | 275 |
(...skipping 18 matching lines...) Expand all Loading... |
292 ScopedTestDeviceSettingsService(); | 294 ScopedTestDeviceSettingsService(); |
293 ~ScopedTestDeviceSettingsService(); | 295 ~ScopedTestDeviceSettingsService(); |
294 | 296 |
295 private: | 297 private: |
296 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 298 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
297 }; | 299 }; |
298 | 300 |
299 } // namespace chromeos | 301 } // namespace chromeos |
300 | 302 |
301 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 303 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |