| 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 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 uint64 size) OVERRIDE; | 35 uint64 size) OVERRIDE; |
| 36 | 36 |
| 37 // Not needed, as this event handler ought to be the final resource. | 37 // Not needed, as this event handler ought to be the final resource. |
| 38 virtual bool OnRequestRedirected(int request_id, | 38 virtual bool OnRequestRedirected(int request_id, |
| 39 const GURL& url, | 39 const GURL& url, |
| 40 content::ResourceResponse* resp, | 40 content::ResourceResponse* resp, |
| 41 bool* defer) OVERRIDE; | 41 bool* defer) OVERRIDE; |
| 42 | 42 |
| 43 // Check if this indeed an X509 cert. | 43 // Check if this indeed an X509 cert. |
| 44 virtual bool OnResponseStarted(int request_id, | 44 virtual bool OnResponseStarted(int request_id, |
| 45 content::ResourceResponse* resp) OVERRIDE; | 45 content::ResourceResponse* resp, |
| 46 bool* defer) OVERRIDE; |
| 46 | 47 |
| 47 // Pass-through implementation. | 48 // Pass-through implementation. |
| 48 virtual bool OnWillStart(int request_id, | 49 virtual bool OnWillStart(int request_id, |
| 49 const GURL& url, | 50 const GURL& url, |
| 50 bool* defer) OVERRIDE; | 51 bool* defer) OVERRIDE; |
| 51 | 52 |
| 52 // Create a new buffer to store received data. | 53 // Create a new buffer to store received data. |
| 53 virtual bool OnWillRead(int request_id, | 54 virtual bool OnWillRead(int request_id, |
| 54 net::IOBuffer** buf, | 55 net::IOBuffer** buf, |
| 55 int* buf_size, | 56 int* buf_size, |
| 56 int min_size) OVERRIDE; | 57 int min_size) OVERRIDE; |
| 57 | 58 |
| 58 // A read was completed, maybe allocate a new buffer for further data. | 59 // A read was completed, maybe allocate a new buffer for further data. |
| 59 virtual bool OnReadCompleted(int request_id, | 60 virtual bool OnReadCompleted(int request_id, |
| 60 int* bytes_read) OVERRIDE; | 61 int* bytes_read, |
| 62 bool* defer) OVERRIDE; |
| 61 | 63 |
| 62 // Done downloading the certificate. | 64 // Done downloading the certificate. |
| 63 virtual bool OnResponseCompleted(int request_id, | 65 virtual bool OnResponseCompleted(int request_id, |
| 64 const net::URLRequestStatus& urs, | 66 const net::URLRequestStatus& urs, |
| 65 const std::string& sec_info) OVERRIDE; | 67 const std::string& sec_info) OVERRIDE; |
| 66 | 68 |
| 67 virtual void OnRequestClosed() OVERRIDE; | 69 virtual void OnRequestClosed() OVERRIDE; |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 virtual ~X509UserCertResourceHandler(); | 72 virtual ~X509UserCertResourceHandler(); |
| 71 | 73 |
| 72 void AssembleResource(); | 74 void AssembleResource(); |
| 73 | 75 |
| 74 GURL url_; | 76 GURL url_; |
| 75 net::URLRequest* request_; | 77 net::URLRequest* request_; |
| 76 size_t content_length_; | 78 size_t content_length_; |
| 77 content::ContentVector buffer_; | 79 content::ContentVector buffer_; |
| 78 scoped_refptr<net::IOBuffer> read_buffer_; | 80 scoped_refptr<net::IOBuffer> read_buffer_; |
| 79 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 81 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
| 80 // The id of the |RenderProcessHost| which started the download. | 82 // The id of the |RenderProcessHost| which started the download. |
| 81 int render_process_host_id_; | 83 int render_process_host_id_; |
| 82 // The id of the |RenderView| which started the download. | 84 // The id of the |RenderView| which started the download. |
| 83 int render_view_id_; | 85 int render_view_id_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); | 87 DISALLOW_COPY_AND_ASSIGN(X509UserCertResourceHandler); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 #endif // CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ | 90 #endif // CONTENT_BROWSER_RENDERER_HOST_X509_USER_CERT_RESOURCE_HANDLER_H_ |
| OLD | NEW |