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_CERTIFICATE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_CERTIFICATE_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/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "content/browser/loader/resource_handler.h" | 15 #include "content/browser/loader/resource_handler.h" |
16 #include "net/base/mime_util.h" | 16 #include "net/base/mime_util.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
mmenke
2014/07/18 15:18:36
Since you're getting rid of url_, don't think this
davidben
2014/07/18 16:14:58
Done.
| |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class IOBuffer; | 20 class IOBuffer; |
21 class URLRequest; | 21 class URLRequest; |
22 class URLRequestStatus; | 22 class URLRequestStatus; |
23 } // namespace net | 23 } // namespace net |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 // This class handles certificate mime types such as: | 27 // This class handles certificate mime types such as: |
28 // - "application/x-x509-user-cert" | 28 // - "application/x-x509-user-cert" |
29 // - "application/x-x509-ca-cert" | 29 // - "application/x-x509-ca-cert" |
30 // - "application/x-pkcs12" | 30 // - "application/x-pkcs12" |
31 // | 31 // |
32 class CertificateResourceHandler : public ResourceHandler { | 32 class CertificateResourceHandler : public ResourceHandler { |
33 public: | 33 public: |
34 explicit CertificateResourceHandler(net::URLRequest* request); | 34 explicit CertificateResourceHandler(net::URLRequest* request); |
35 virtual ~CertificateResourceHandler(); | 35 virtual ~CertificateResourceHandler(); |
36 | 36 |
37 virtual bool OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 37 virtual bool OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
38 | 38 |
39 // Not needed, as this event handler ought to be the final resource. | 39 // Not needed, as this event handler ought to be the final resource. |
40 virtual bool OnRequestRedirected(const GURL& url, | 40 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
41 ResourceResponse* resp, | 41 ResourceResponse* resp, |
42 bool* defer) OVERRIDE; | 42 bool* defer) OVERRIDE; |
43 | 43 |
44 // Check if this indeed an X509 cert. | 44 // Check if this indeed an X509 cert. |
45 virtual bool OnResponseStarted(ResourceResponse* resp, | 45 virtual bool OnResponseStarted(ResourceResponse* resp, |
46 bool* defer) OVERRIDE; | 46 bool* defer) OVERRIDE; |
47 | 47 |
48 // Pass-through implementation. | 48 // Pass-through implementation. |
49 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; | 49 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; |
50 | 50 |
(...skipping 15 matching lines...) Expand all Loading... | |
66 | 66 |
67 // N/A to cert downloading. | 67 // N/A to cert downloading. |
68 virtual void OnDataDownloaded(int bytes_downloaded) OVERRIDE; | 68 virtual void OnDataDownloaded(int bytes_downloaded) OVERRIDE; |
69 | 69 |
70 private: | 70 private: |
71 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, | 71 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, |
72 size_t> > ContentVector; | 72 size_t> > ContentVector; |
73 | 73 |
74 void AssembleResource(); | 74 void AssembleResource(); |
75 | 75 |
76 GURL url_; | |
77 size_t content_length_; | 76 size_t content_length_; |
78 ContentVector buffer_; | 77 ContentVector buffer_; |
79 scoped_refptr<net::IOBuffer> read_buffer_; | 78 scoped_refptr<net::IOBuffer> read_buffer_; |
80 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 79 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
81 net::CertificateMimeType cert_type_; | 80 net::CertificateMimeType cert_type_; |
82 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); | 81 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace content | 84 } // namespace content |
86 | 85 |
87 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ | 86 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
OLD | NEW |