| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/renderer_host/resource_handler.h" | 10 #include "chrome/browser/renderer_host/resource_handler.h" |
| 11 | 11 |
| 12 class ResourceDispatcherHost; | 12 class ResourceDispatcherHost; |
| 13 | 13 |
| 14 // Used to buffer a request until enough data has been received. | 14 // Used to buffer a request until enough data has been received. |
| 15 class BufferedResourceHandler : public ResourceHandler { | 15 class BufferedResourceHandler : public ResourceHandler { |
| 16 public: | 16 public: |
| 17 BufferedResourceHandler(ResourceHandler* handler, | 17 BufferedResourceHandler(ResourceHandler* handler, |
| 18 ResourceDispatcherHost* host, | 18 ResourceDispatcherHost* host, |
| 19 URLRequest* request); | 19 URLRequest* request); |
| 20 | 20 |
| 21 // ResourceHandler implementation: | 21 // ResourceHandler implementation: |
| 22 bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 22 bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 23 bool OnRequestRedirected(int request_id, const GURL& new_url); | 23 bool OnRequestRedirected(int request_id, const GURL& new_url); |
| 24 bool OnResponseStarted(int request_id, ResourceResponse* response); | 24 bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 25 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 25 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 26 int min_size); | 26 int min_size); |
| 27 bool OnReadCompleted(int request_id, int* bytes_read); | 27 bool OnReadCompleted(int request_id, int* bytes_read); |
| 28 bool OnResponseCompleted(int request_id, const URLRequestStatus& status); | 28 bool OnResponseCompleted(int request_id, |
| 29 const URLRequestStatus& status, |
| 30 const std::string& security_info); |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 // Returns true if we should delay OnResponseStarted forwarding. | 33 // Returns true if we should delay OnResponseStarted forwarding. |
| 32 bool DelayResponse(); | 34 bool DelayResponse(); |
| 33 | 35 |
| 34 // Returns true if there will be a need to parse the DocType of the document | 36 // Returns true if there will be a need to parse the DocType of the document |
| 35 // to determine the right way to handle it. | 37 // to determine the right way to handle it. |
| 36 bool ShouldBuffer(const GURL& url, const std::string& mime_type); | 38 bool ShouldBuffer(const GURL& url, const std::string& mime_type); |
| 37 | 39 |
| 38 // Returns true if there is enough information to process the DocType. | 40 // Returns true if there is enough information to process the DocType. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 int bytes_read_; | 57 int bytes_read_; |
| 56 bool sniff_content_; | 58 bool sniff_content_; |
| 57 bool should_buffer_; | 59 bool should_buffer_; |
| 58 bool buffering_; | 60 bool buffering_; |
| 59 bool finished_; | 61 bool finished_; |
| 60 | 62 |
| 61 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 63 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 66 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| OLD | NEW |