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