| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/renderer_host/resource_handler.h" | 11 #include "chrome/browser/renderer_host/resource_handler.h" |
| 12 | 12 |
| 13 class MessageLoop; | 13 class MessageLoop; |
| 14 class ResourceDispatcherHost; | 14 class ResourceDispatcherHost; |
| 15 |
| 16 namespace net { |
| 15 class URLRequest; | 17 class URLRequest; |
| 18 } // namespace net |
| 16 | 19 |
| 17 // Used to buffer a request until enough data has been received. | 20 // Used to buffer a request until enough data has been received. |
| 18 class BufferedResourceHandler : public ResourceHandler { | 21 class BufferedResourceHandler : public ResourceHandler { |
| 19 public: | 22 public: |
| 20 BufferedResourceHandler(ResourceHandler* handler, | 23 BufferedResourceHandler(ResourceHandler* handler, |
| 21 ResourceDispatcherHost* host, | 24 ResourceDispatcherHost* host, |
| 22 URLRequest* request); | 25 net::URLRequest* request); |
| 23 | 26 |
| 24 // ResourceHandler implementation: | 27 // ResourceHandler implementation: |
| 25 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 28 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 26 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 29 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
| 27 ResourceResponse* response, bool* defer); | 30 ResourceResponse* response, bool* defer); |
| 28 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 31 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 29 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 32 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
| 30 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 33 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 31 int min_size); | 34 int min_size); |
| 32 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 35 virtual bool OnReadCompleted(int request_id, int* bytes_read); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 75 |
| 73 // Called on the file thread to load the list of plugins. | 76 // Called on the file thread to load the list of plugins. |
| 74 void LoadPlugins(); | 77 void LoadPlugins(); |
| 75 | 78 |
| 76 // Called on the IO thread once the list of plugins has been loaded. | 79 // Called on the IO thread once the list of plugins has been loaded. |
| 77 void OnPluginsLoaded(); | 80 void OnPluginsLoaded(); |
| 78 | 81 |
| 79 scoped_refptr<ResourceHandler> real_handler_; | 82 scoped_refptr<ResourceHandler> real_handler_; |
| 80 scoped_refptr<ResourceResponse> response_; | 83 scoped_refptr<ResourceResponse> response_; |
| 81 ResourceDispatcherHost* host_; | 84 ResourceDispatcherHost* host_; |
| 82 URLRequest* request_; | 85 net::URLRequest* request_; |
| 83 scoped_refptr<net::IOBuffer> read_buffer_; | 86 scoped_refptr<net::IOBuffer> read_buffer_; |
| 84 scoped_refptr<net::IOBuffer> my_buffer_; | 87 scoped_refptr<net::IOBuffer> my_buffer_; |
| 85 int read_buffer_size_; | 88 int read_buffer_size_; |
| 86 int bytes_read_; | 89 int bytes_read_; |
| 87 bool sniff_content_; | 90 bool sniff_content_; |
| 88 bool should_buffer_; | 91 bool should_buffer_; |
| 89 bool wait_for_plugins_; | 92 bool wait_for_plugins_; |
| 90 bool buffering_; | 93 bool buffering_; |
| 91 bool finished_; | 94 bool finished_; |
| 92 | 95 |
| 93 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 96 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 99 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| OLD | NEW |