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_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_CRYPTO_FILE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_CRYPTO_FILE_RESOURCE_HANDLER_H_ |
Ryan Sleevi
2012/11/13 19:37:50
nit: headers
| |
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/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "content/browser/renderer_host/resource_handler.h" | 15 #include "content/browser/renderer_host/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 the cryptographics mime-types supported by |
Ryan Sleevi
2012/11/13 19:37:50
nit: s/cryptographics/cryptographic/
| |
27 // which is a certificate generated by a CA, typically after a previous | 28 // net::IsSupportedCertificateMimeType(mime_type). These typically |
28 // <keygen> form post. | 29 // corresponds to X509 User certificates, but also on some platforms, to |
30 // X509 CA certificates and PKCS#12 keychains. | |
Ryan Sleevi
2012/11/13 19:37:50
nit: s/X509/X.509/ (throughout the CL)
digit1
2012/11/15 17:42:14
Done.
| |
31 // | |
29 | 32 |
30 class X509UserCertResourceHandler : public ResourceHandler { | 33 class CertificateResourceHandler : public ResourceHandler { |
31 public: | 34 public: |
32 X509UserCertResourceHandler(net::URLRequest* request, | 35 CertificateResourceHandler(net::URLRequest* request, |
33 int render_process_host_id, | 36 int render_process_host_id, |
34 int render_view_id); | 37 int render_view_id); |
35 virtual ~X509UserCertResourceHandler(); | 38 virtual ~CertificateResourceHandler(); |
36 | 39 |
37 virtual bool OnUploadProgress(int request_id, | 40 virtual bool OnUploadProgress(int request_id, |
38 uint64 position, | 41 uint64 position, |
39 uint64 size) OVERRIDE; | 42 uint64 size) OVERRIDE; |
40 | 43 |
41 // Not needed, as this event handler ought to be the final resource. | 44 // Not needed, as this event handler ought to be the final resource. |
42 virtual bool OnRequestRedirected(int request_id, | 45 virtual bool OnRequestRedirected(int request_id, |
43 const GURL& url, | 46 const GURL& url, |
44 ResourceResponse* resp, | 47 ResourceResponse* resp, |
45 bool* defer) OVERRIDE; | 48 bool* defer) OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... | |
74 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, | 77 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, |
75 size_t> > ContentVector; | 78 size_t> > ContentVector; |
76 | 79 |
77 void AssembleResource(); | 80 void AssembleResource(); |
78 | 81 |
79 GURL url_; | 82 GURL url_; |
80 net::URLRequest* request_; | 83 net::URLRequest* request_; |
81 size_t content_length_; | 84 size_t content_length_; |
82 ContentVector buffer_; | 85 ContentVector buffer_; |
83 scoped_refptr<net::IOBuffer> read_buffer_; | 86 scoped_refptr<net::IOBuffer> read_buffer_; |
84 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 87 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded file. |
85 // The id of the |RenderProcessHost| which started the download. | 88 // The id of the |RenderProcessHost| which started the download. |
86 int render_process_host_id_; | 89 int render_process_host_id_; |
87 // The id of the |RenderView| which started the download. | 90 // The id of the |RenderView| which started the download. |
88 int render_view_id_; | 91 int render_view_id_; |
89 | 92 net::CertificateType cert_type_; |
90 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); | 93 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); |
91 }; | 94 }; |
92 | 95 |
93 } // namespace content | 96 } // namespace content |
94 | 97 |
95 #endif // CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 98 #endif // CONTENT_BROWSER_RENDERER_HOST_CRYPTO_FILE_RESOURCE_HANDLER_H_ |
OLD | NEW |