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 "chromeos/dbus/session_manager_client.h" | 19 #include "chromeos/dbus/session_manager_client.h" |
19 #include "chromeos/tpm_token_loader.h" | 20 #include "chromeos/tpm_token_loader.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
21 | 22 |
22 namespace crypto { | 23 namespace crypto { |
23 class RSAPrivateKey; | 24 class RSAPrivateKey; |
24 } | 25 } |
25 | 26 |
26 namespace enterprise_management { | 27 namespace enterprise_management { |
27 class ChromeDeviceSettingsProto; | 28 class ChromeDeviceSettingsProto; |
(...skipping 11 matching lines...) Expand all Loading... |
39 // class is immutable and refcounted in order to allow safe access from any | 40 // class is immutable and refcounted in order to allow safe access from any |
40 // thread. | 41 // thread. |
41 class OwnerKey : public base::RefCountedThreadSafe<OwnerKey> { | 42 class OwnerKey : public base::RefCountedThreadSafe<OwnerKey> { |
42 public: | 43 public: |
43 OwnerKey(scoped_ptr<std::vector<uint8> > public_key, | 44 OwnerKey(scoped_ptr<std::vector<uint8> > public_key, |
44 scoped_ptr<crypto::RSAPrivateKey> private_key); | 45 scoped_ptr<crypto::RSAPrivateKey> private_key); |
45 | 46 |
46 const std::vector<uint8>* public_key() { | 47 const std::vector<uint8>* public_key() { |
47 return public_key_.get(); | 48 return public_key_.get(); |
48 } | 49 } |
| 50 |
| 51 std::string public_key_as_string() { |
| 52 return std::string(reinterpret_cast<const char*>( |
| 53 vector_as_array(public_key_.get())), public_key_->size()); |
| 54 } |
| 55 |
49 crypto::RSAPrivateKey* private_key() { | 56 crypto::RSAPrivateKey* private_key() { |
50 return private_key_.get(); | 57 return private_key_.get(); |
51 } | 58 } |
52 | 59 |
53 private: | 60 private: |
54 friend class base::RefCountedThreadSafe<OwnerKey>; | 61 friend class base::RefCountedThreadSafe<OwnerKey>; |
55 ~OwnerKey(); | 62 ~OwnerKey(); |
56 | 63 |
57 scoped_ptr<std::vector<uint8> > public_key_; | 64 scoped_ptr<std::vector<uint8> > public_key_; |
58 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 65 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 ScopedTestDeviceSettingsService(); | 268 ScopedTestDeviceSettingsService(); |
262 ~ScopedTestDeviceSettingsService(); | 269 ~ScopedTestDeviceSettingsService(); |
263 | 270 |
264 private: | 271 private: |
265 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 272 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
266 }; | 273 }; |
267 | 274 |
268 } // namespace chromeos | 275 } // namespace chromeos |
269 | 276 |
270 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 277 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |