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 CONTENT_BROWSER_LOADER_X509_USER_CERT_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_X509_USER_CERT_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/ref_counted.h" | |
15 #include "content/browser/loader/resource_handler.h" | 15 #include "content/browser/loader/resource_handler.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "net/base/mime_util.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 class IOBuffer; | 20 class IOBuffer; |
20 class URLRequest; | 21 class URLRequest; |
21 class URLRequestStatus; | 22 class URLRequestStatus; |
22 } // namespace net | 23 } // namespace net |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 // This class handles the "application/x-x509-user-cert" mime-type | 27 // This class handles certificate mime types such as: |
27 // which is a certificate generated by a CA, typically after a previous | 28 // - "application/x-x509-user-cert" |
28 // <keygen> form post. | 29 // - "application/x-x509-ca-cert" |
29 | 30 // - "application/x-pkcs12" |
30 class X509UserCertResourceHandler : public ResourceHandler { | 31 // |
| 32 class CertificateResourceHandler : public ResourceHandler { |
31 public: | 33 public: |
32 X509UserCertResourceHandler(net::URLRequest* request, | 34 CertificateResourceHandler(net::URLRequest* request, |
33 int render_process_host_id, | 35 int render_process_host_id, |
34 int render_view_id); | 36 int render_view_id); |
35 virtual ~X509UserCertResourceHandler(); | 37 virtual ~CertificateResourceHandler(); |
36 | 38 |
37 virtual bool OnUploadProgress(int request_id, | 39 virtual bool OnUploadProgress(int request_id, |
38 uint64 position, | 40 uint64 position, |
39 uint64 size) OVERRIDE; | 41 uint64 size) OVERRIDE; |
40 | 42 |
41 // Not needed, as this event handler ought to be the final resource. | 43 // Not needed, as this event handler ought to be the final resource. |
42 virtual bool OnRequestRedirected(int request_id, | 44 virtual bool OnRequestRedirected(int request_id, |
43 const GURL& url, | 45 const GURL& url, |
44 ResourceResponse* resp, | 46 ResourceResponse* resp, |
45 bool* defer) OVERRIDE; | 47 bool* defer) OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 GURL url_; | 81 GURL url_; |
80 net::URLRequest* request_; | 82 net::URLRequest* request_; |
81 size_t content_length_; | 83 size_t content_length_; |
82 ContentVector buffer_; | 84 ContentVector buffer_; |
83 scoped_refptr<net::IOBuffer> read_buffer_; | 85 scoped_refptr<net::IOBuffer> read_buffer_; |
84 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 86 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
85 // The id of the |RenderProcessHost| which started the download. | 87 // The id of the |RenderProcessHost| which started the download. |
86 int render_process_host_id_; | 88 int render_process_host_id_; |
87 // The id of the |RenderView| which started the download. | 89 // The id of the |RenderView| which started the download. |
88 int render_view_id_; | 90 int render_view_id_; |
89 | 91 net::CertificateMimeType cert_type_; |
90 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); | 92 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); |
91 }; | 93 }; |
92 | 94 |
93 } // namespace content | 95 } // namespace content |
94 | 96 |
95 #endif // CONTENT_BROWSER_LOADER_X509_USER_CERT_RESOURCE_HANDLER_H_ | 97 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
OLD | NEW |