OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "chrome/browser/chromeos/platform_keys/key_permissions.h" | 17 #include "chrome/browser/chromeos/platform_keys/key_permissions.h" |
18 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" | 18 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" |
19 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
20 | 20 |
| 21 class PrefService; |
| 22 |
| 23 namespace base { |
| 24 class ListValue; |
| 25 class Value; |
| 26 } |
| 27 |
21 namespace content { | 28 namespace content { |
22 class BrowserContext; | 29 class BrowserContext; |
23 class WebContents; | 30 class WebContents; |
24 } | 31 } |
25 | 32 |
26 namespace base { | |
27 class ListValue; | |
28 class Value; | |
29 } | |
30 | |
31 namespace extensions { | 33 namespace extensions { |
32 class StateStore; | 34 class StateStore; |
33 } | 35 } |
34 | 36 |
35 namespace net { | 37 namespace net { |
36 class X509Certificate; | 38 class X509Certificate; |
37 typedef std::vector<scoped_refptr<X509Certificate>> CertificateList; | 39 typedef std::vector<scoped_refptr<X509Certificate>> CertificateList; |
38 } | 40 } |
39 | 41 |
| 42 namespace policy { |
| 43 class PolicyService; |
| 44 } |
| 45 |
40 namespace chromeos { | 46 namespace chromeos { |
41 | 47 |
42 class PlatformKeysService : public KeyedService { | 48 class PlatformKeysService : public KeyedService { |
43 public: | 49 public: |
44 // The SelectDelegate is used to select a single certificate from all | 50 // The SelectDelegate is used to select a single certificate from all |
45 // certificates matching a request (see SelectClientCertificates). E.g. this | 51 // certificates matching a request (see SelectClientCertificates). E.g. this |
46 // can happen by exposing UI to let the user select. | 52 // can happen by exposing UI to let the user select. |
47 class SelectDelegate { | 53 class SelectDelegate { |
48 public: | 54 public: |
49 using CertificateSelectedCallback = base::Callback<void( | 55 using CertificateSelectedCallback = base::Callback<void( |
(...skipping 20 matching lines...) Expand all Loading... |
70 private: | 76 private: |
71 DISALLOW_ASSIGN(SelectDelegate); | 77 DISALLOW_ASSIGN(SelectDelegate); |
72 }; | 78 }; |
73 | 79 |
74 // Stores registration information in |state_store|, i.e. for each extension | 80 // Stores registration information in |state_store|, i.e. for each extension |
75 // the list of public keys that are valid to be used for signing. See | 81 // the list of public keys that are valid to be used for signing. See |
76 // |KeyPermissions| for details. | 82 // |KeyPermissions| for details. |
77 // |browser_context| and |state_store| must not be null and outlive this | 83 // |browser_context| and |state_store| must not be null and outlive this |
78 // object. | 84 // object. |
79 explicit PlatformKeysService(bool profile_is_managed, | 85 explicit PlatformKeysService(bool profile_is_managed, |
| 86 PrefService* profile_prefs, |
| 87 policy::PolicyService* profile_policies, |
80 content::BrowserContext* browser_context, | 88 content::BrowserContext* browser_context, |
81 extensions::StateStore* state_store); | 89 extensions::StateStore* state_store); |
82 | 90 |
83 ~PlatformKeysService() override; | 91 ~PlatformKeysService() override; |
84 | 92 |
85 // Sets the delegate which will be used for interactive | 93 // Sets the delegate which will be used for interactive |
86 // SelectClientCertificates calls. | 94 // SelectClientCertificates calls. |
87 void SetSelectDelegate(scoped_ptr<SelectDelegate> delegate); | 95 void SetSelectDelegate(scoped_ptr<SelectDelegate> delegate); |
88 | 96 |
89 // If the generation was successful, |public_key_spki_der| will contain the | 97 // If the generation was successful, |public_key_spki_der| will contain the |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 scoped_ptr<SelectDelegate> select_delegate_; | 217 scoped_ptr<SelectDelegate> select_delegate_; |
210 std::queue<linked_ptr<Task>> tasks_; | 218 std::queue<linked_ptr<Task>> tasks_; |
211 base::WeakPtrFactory<PlatformKeysService> weak_factory_; | 219 base::WeakPtrFactory<PlatformKeysService> weak_factory_; |
212 | 220 |
213 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService); | 221 DISALLOW_COPY_AND_ASSIGN(PlatformKeysService); |
214 }; | 222 }; |
215 | 223 |
216 } // namespace chromeos | 224 } // namespace chromeos |
217 | 225 |
218 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ | 226 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_SERVICE_H_ |
OLD | NEW |