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