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_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ |
6 #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class HttpNetworkSession; | |
15 class SSLCertRequestInfo; | 14 class SSLCertRequestInfo; |
16 class X509Certificate; | 15 class X509Certificate; |
17 } | 16 } |
18 | 17 |
| 18 namespace content { |
| 19 class BrowserContext; |
| 20 } |
| 21 |
19 class SSLClientAuthObserver : public content::NotificationObserver { | 22 class SSLClientAuthObserver : public content::NotificationObserver { |
20 public: | 23 public: |
21 SSLClientAuthObserver( | 24 SSLClientAuthObserver( |
22 const net::HttpNetworkSession* network_session, | 25 const content::BrowserContext* browser_context, |
23 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, | 26 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
24 const base::Callback<void(net::X509Certificate*)>& callback); | 27 const base::Callback<void(net::X509Certificate*)>& callback); |
25 virtual ~SSLClientAuthObserver(); | 28 virtual ~SSLClientAuthObserver(); |
26 | 29 |
27 // UI should implement this to close the dialog. | 30 // UI should implement this to close the dialog. |
28 virtual void OnCertSelectedByNotification() = 0; | 31 virtual void OnCertSelectedByNotification() = 0; |
29 | 32 |
30 // Send content the certificate. Can also call with NULL if the user | 33 // Send content the certificate. Can also call with NULL if the user |
31 // cancelled. Derived classes must use this instead of caching the callback | 34 // cancelled. Derived classes must use this instead of caching the callback |
32 // and calling it directly. | 35 // and calling it directly. |
(...skipping 12 matching lines...) Expand all Loading... |
45 net::SSLCertRequestInfo* cert_request_info() const { | 48 net::SSLCertRequestInfo* cert_request_info() const { |
46 return cert_request_info_.get(); | 49 return cert_request_info_.get(); |
47 } | 50 } |
48 | 51 |
49 private: | 52 private: |
50 // content::NotificationObserver implementation: | 53 // content::NotificationObserver implementation: |
51 virtual void Observe(int type, | 54 virtual void Observe(int type, |
52 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
53 const content::NotificationDetails& details) OVERRIDE; | 56 const content::NotificationDetails& details) OVERRIDE; |
54 | 57 |
55 const net::HttpNetworkSession* network_session_; | 58 const content::BrowserContext* browser_context_; |
56 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; | 59 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
57 base::Callback<void(net::X509Certificate*)> callback_; | 60 base::Callback<void(net::X509Certificate*)> callback_; |
58 content::NotificationRegistrar notification_registrar_; | 61 content::NotificationRegistrar notification_registrar_; |
59 | 62 |
60 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); | 63 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); |
61 }; | 64 }; |
62 | 65 |
63 #endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ | 66 #endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ |
OLD | NEW |