OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ |
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ | 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "sql/connection.h" | 12 #include "sql/connection.h" |
13 #include "sql/meta_table.h" | 13 #include "sql/meta_table.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } // namespace base | 19 } // namespace base |
20 | 20 |
21 namespace quota { | 21 namespace storage { |
22 class SpecialStoragePolicy; | 22 class SpecialStoragePolicy; |
23 } // namespace quota | 23 } // namespace storage |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 // This class represents a persistent cache of WebRTC identities. | 27 // This class represents a persistent cache of WebRTC identities. |
28 // It can be created/destroyed/Close() on any thread. All other members should | 28 // It can be created/destroyed/Close() on any thread. All other members should |
29 // be accessed on the IO thread. | 29 // be accessed on the IO thread. |
30 class WebRTCIdentityStoreBackend | 30 class WebRTCIdentityStoreBackend |
31 : public base::RefCountedThreadSafe<WebRTCIdentityStoreBackend> { | 31 : public base::RefCountedThreadSafe<WebRTCIdentityStoreBackend> { |
32 public: | 32 public: |
33 typedef base::Callback<void(int error, | 33 typedef base::Callback<void(int error, |
34 const std::string& certificate, | 34 const std::string& certificate, |
35 const std::string& private_key)> | 35 const std::string& private_key)> |
36 FindIdentityCallback; | 36 FindIdentityCallback; |
37 | 37 |
38 // No data is saved on disk if |path| is empty. Identites older than | 38 // No data is saved on disk if |path| is empty. Identites older than |
39 // |validity_period| will be removed lazily. | 39 // |validity_period| will be removed lazily. |
40 WebRTCIdentityStoreBackend(const base::FilePath& path, | 40 WebRTCIdentityStoreBackend(const base::FilePath& path, |
41 quota::SpecialStoragePolicy* policy, | 41 storage::SpecialStoragePolicy* policy, |
42 base::TimeDelta validity_period); | 42 base::TimeDelta validity_period); |
43 | 43 |
44 // Finds the identity with |origin|, |identity_name|, and |common_name| from | 44 // Finds the identity with |origin|, |identity_name|, and |common_name| from |
45 // the DB. | 45 // the DB. |
46 // |origin| is the origin of the identity; | 46 // |origin| is the origin of the identity; |
47 // |identity_name| is used to identify an identity within an origin; | 47 // |identity_name| is used to identify an identity within an origin; |
48 // |common_name| is the common name used to generate the certificate; | 48 // |common_name| is the common name used to generate the certificate; |
49 // |callback| is the callback to return the find result. | 49 // |callback| is the callback to return the find result. |
50 // Returns true if |callback| will be called. | 50 // Returns true if |callback| will be called. |
51 // Should be called on the IO thread. | 51 // Should be called on the IO thread. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // The persistent storage loading state. | 111 // The persistent storage loading state. |
112 LoadingState state_; | 112 LoadingState state_; |
113 // The persistent storage of identities. | 113 // The persistent storage of identities. |
114 scoped_refptr<SqlLiteStorage> sql_lite_storage_; | 114 scoped_refptr<SqlLiteStorage> sql_lite_storage_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityStoreBackend); | 116 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityStoreBackend); |
117 }; | 117 }; |
118 } | 118 } |
119 | 119 |
120 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ | 120 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_BACKEND_H_ |
OLD | NEW |