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_X509_USER_CERT_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 #include <vector> |
10 | 12 |
11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
13 #include "content/browser/download/download_buffer.h" | |
14 #include "content/browser/renderer_host/resource_handler.h" | 16 #include "content/browser/renderer_host/resource_handler.h" |
15 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
16 | 18 |
17 namespace net { | 19 namespace net { |
18 class IOBuffer; | 20 class IOBuffer; |
19 class URLRequest; | 21 class URLRequest; |
20 class URLRequestStatus; | 22 class URLRequestStatus; |
21 } // namespace net | 23 } // namespace net |
22 | 24 |
23 // This class handles the "application/x-x509-user-cert" mime-type | 25 // This class handles the "application/x-x509-user-cert" mime-type |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 bool* defer) OVERRIDE; | 64 bool* defer) OVERRIDE; |
63 | 65 |
64 // Done downloading the certificate. | 66 // Done downloading the certificate. |
65 virtual bool OnResponseCompleted(int request_id, | 67 virtual bool OnResponseCompleted(int request_id, |
66 const net::URLRequestStatus& urs, | 68 const net::URLRequestStatus& urs, |
67 const std::string& sec_info) OVERRIDE; | 69 const std::string& sec_info) OVERRIDE; |
68 | 70 |
69 virtual void OnRequestClosed() OVERRIDE; | 71 virtual void OnRequestClosed() OVERRIDE; |
70 | 72 |
71 private: | 73 private: |
| 74 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, |
| 75 size_t> > ContentVector; |
| 76 |
72 virtual ~X509UserCertResourceHandler(); | 77 virtual ~X509UserCertResourceHandler(); |
73 | 78 |
74 void AssembleResource(); | 79 void AssembleResource(); |
75 | 80 |
76 GURL url_; | 81 GURL url_; |
77 net::URLRequest* request_; | 82 net::URLRequest* request_; |
78 size_t content_length_; | 83 size_t content_length_; |
79 content::ContentVector buffer_; | 84 ContentVector buffer_; |
80 scoped_refptr<net::IOBuffer> read_buffer_; | 85 scoped_refptr<net::IOBuffer> read_buffer_; |
81 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 86 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
82 // The id of the |RenderProcessHost| which started the download. | 87 // The id of the |RenderProcessHost| which started the download. |
83 int render_process_host_id_; | 88 int render_process_host_id_; |
84 // The id of the |RenderView| which started the download. | 89 // The id of the |RenderView| which started the download. |
85 int render_view_id_; | 90 int render_view_id_; |
86 | 91 |
87 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); | 92 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); |
88 }; | 93 }; |
89 | 94 |
90 #endif // CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 95 #endif // CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
OLD | NEW |