| 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> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ResourceResponse* resp, | 49 ResourceResponse* resp, |
| 50 bool* defer) OVERRIDE; | 50 bool* defer) OVERRIDE; |
| 51 | 51 |
| 52 // Pass-through implementation. | 52 // Pass-through implementation. |
| 53 virtual bool OnWillStart(int request_id, | 53 virtual bool OnWillStart(int request_id, |
| 54 const GURL& url, | 54 const GURL& url, |
| 55 bool* defer) OVERRIDE; | 55 bool* defer) OVERRIDE; |
| 56 | 56 |
| 57 // Create a new buffer to store received data. | 57 // Create a new buffer to store received data. |
| 58 virtual bool OnWillRead(int request_id, | 58 virtual bool OnWillRead(int request_id, |
| 59 scoped_refptr<net::IOBuffer>* buf, | 59 net::IOBuffer** buf, |
| 60 int* buf_size, | 60 int* buf_size, |
| 61 int min_size) OVERRIDE; | 61 int min_size) OVERRIDE; |
| 62 | 62 |
| 63 // A read was completed, maybe allocate a new buffer for further data. | 63 // A read was completed, maybe allocate a new buffer for further data. |
| 64 virtual bool OnReadCompleted(int request_id, | 64 virtual bool OnReadCompleted(int request_id, |
| 65 int bytes_read, | 65 int bytes_read, |
| 66 bool* defer) OVERRIDE; | 66 bool* defer) OVERRIDE; |
| 67 | 67 |
| 68 // Done downloading the certificate. | 68 // Done downloading the certificate. |
| 69 virtual bool OnResponseCompleted(int request_id, | 69 virtual bool OnResponseCompleted(int request_id, |
| 70 const net::URLRequestStatus& urs, | 70 const net::URLRequestStatus& urs, |
| 71 const std::string& sec_info) OVERRIDE; | 71 const std::string& sec_info) OVERRIDE; |
| 72 | 72 |
| 73 // N/A to cert downloading. | 73 // N/A to cert downloading. |
| 74 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; | 74 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, | 77 typedef std::vector<std::pair<scoped_refptr<net::IOBuffer>, |
| 78 size_t> > ContentVector; | 78 size_t> > ContentVector; |
| 79 | 79 |
| 80 void AssembleResource(); | 80 void AssembleResource(); |
| 81 | 81 |
| 82 GURL url_; | 82 GURL url_; |
| 83 net::URLRequest* request_; |
| 83 size_t content_length_; | 84 size_t content_length_; |
| 84 ContentVector buffer_; | 85 ContentVector buffer_; |
| 85 scoped_refptr<net::IOBuffer> read_buffer_; | 86 scoped_refptr<net::IOBuffer> read_buffer_; |
| 86 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. | 87 scoped_refptr<net::IOBuffer> resource_buffer_; // Downloaded certificate. |
| 87 net::CertificateMimeType cert_type_; | 88 net::CertificateMimeType cert_type_; |
| 88 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); | 89 DISALLOW_COPY_AND_ASSIGN(CertificateResourceHandler); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace content | 92 } // namespace content |
| 92 | 93 |
| 93 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ | 94 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
| OLD | NEW |