| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BUFFERED_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Used to buffer a request until enough data has been received. | 23 // Used to buffer a request until enough data has been received. |
| 24 class BufferedResourceHandler : public ResourceHandler { | 24 class BufferedResourceHandler : public ResourceHandler { |
| 25 public: | 25 public: |
| 26 BufferedResourceHandler(ResourceHandler* handler, | 26 BufferedResourceHandler(ResourceHandler* handler, |
| 27 ResourceDispatcherHost* host, | 27 ResourceDispatcherHost* host, |
| 28 net::URLRequest* request); | 28 net::URLRequest* request); |
| 29 | 29 |
| 30 // ResourceHandler implementation: | 30 // ResourceHandler implementation: |
| 31 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 31 virtual bool OnUploadProgress(int request_id, |
| 32 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 32 uint64 position, |
| 33 ResourceResponse* response, bool* defer); | 33 uint64 size) OVERRIDE; |
| 34 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 34 virtual bool OnRequestRedirected(int request_id, |
| 35 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 35 const GURL& new_url, |
| 36 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 36 ResourceResponse* response, |
| 37 int min_size); | 37 bool* defer) OVERRIDE; |
| 38 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 38 virtual bool OnResponseStarted(int request_id, |
| 39 ResourceResponse* response) OVERRIDE; |
| 40 virtual bool OnWillStart(int request_id, |
| 41 const GURL& url, |
| 42 bool* defer) OVERRIDE; |
| 43 virtual bool OnWillRead(int request_id, |
| 44 net::IOBuffer** buf, |
| 45 int* buf_size, |
| 46 int min_size) OVERRIDE; |
| 47 virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; |
| 39 virtual bool OnResponseCompleted(int request_id, | 48 virtual bool OnResponseCompleted(int request_id, |
| 40 const net::URLRequestStatus& status, | 49 const net::URLRequestStatus& status, |
| 41 const std::string& security_info); | 50 const std::string& security_info) OVERRIDE; |
| 42 virtual void OnRequestClosed(); | 51 virtual void OnRequestClosed() OVERRIDE; |
| 43 | 52 |
| 44 private: | 53 private: |
| 45 virtual ~BufferedResourceHandler(); | 54 virtual ~BufferedResourceHandler(); |
| 46 | 55 |
| 47 // Returns true if we should delay OnResponseStarted forwarding. | 56 // Returns true if we should delay OnResponseStarted forwarding. |
| 48 bool DelayResponse(); | 57 bool DelayResponse(); |
| 49 | 58 |
| 50 // Returns true if there is enough information to process the DocType. | 59 // Returns true if there is enough information to process the DocType. |
| 51 bool DidBufferEnough(int bytes_read); | 60 bool DidBufferEnough(int bytes_read); |
| 52 | 61 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int bytes_read_; | 94 int bytes_read_; |
| 86 bool sniff_content_; | 95 bool sniff_content_; |
| 87 bool wait_for_plugins_; | 96 bool wait_for_plugins_; |
| 88 bool buffering_; | 97 bool buffering_; |
| 89 bool finished_; | 98 bool finished_; |
| 90 | 99 |
| 91 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 100 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
| 92 }; | 101 }; |
| 93 | 102 |
| 94 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 103 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| OLD | NEW |