| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 23 bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 24 bool OnRequestRedirected(int request_id, const GURL& new_url, | 24 bool OnRequestRedirected(int request_id, const GURL& new_url, |
| 25 ResourceResponse* response, bool* defer); | 25 ResourceResponse* response, bool* defer); |
| 26 bool OnResponseStarted(int request_id, ResourceResponse* response); | 26 bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 27 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 27 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 28 int min_size); | 28 int min_size); |
| 29 bool OnReadCompleted(int request_id, int* bytes_read); | 29 bool OnReadCompleted(int request_id, int* bytes_read); |
| 30 bool OnResponseCompleted(int request_id, | 30 bool OnResponseCompleted(int request_id, |
| 31 const URLRequestStatus& status, | 31 const URLRequestStatus& status, |
| 32 const std::string& security_info); | 32 const std::string& security_info); |
| 33 void OnRequestClosed(); |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // Returns true if we should delay OnResponseStarted forwarding. | 36 // Returns true if we should delay OnResponseStarted forwarding. |
| 36 bool DelayResponse(); | 37 bool DelayResponse(); |
| 37 | 38 |
| 38 // Returns true if there will be a need to parse the DocType of the document | 39 // Returns true if there will be a need to parse the DocType of the document |
| 39 // to determine the right way to handle it. | 40 // to determine the right way to handle it. |
| 40 bool ShouldBuffer(const GURL& url, const std::string& mime_type); | 41 bool ShouldBuffer(const GURL& url, const std::string& mime_type); |
| 41 | 42 |
| 42 // Returns true if there is enough information to process the DocType. | 43 // Returns true if there is enough information to process the DocType. |
| 43 bool DidBufferEnough(int bytes_read); | 44 bool DidBufferEnough(int bytes_read); |
| 44 | 45 |
| 45 // Returns true if we have to keep buffering data. | 46 // Returns true if we have to keep buffering data. |
| 46 bool KeepBuffering(int bytes_read); | 47 bool KeepBuffering(int bytes_read); |
| 47 | 48 |
| 48 // Sends a pending OnResponseStarted notification. |in_complete| is true if | 49 // Sends a pending OnResponseStarted notification. |in_complete| is true if |
| 49 // this is invoked from |OnResponseCompleted|. | 50 // this is invoked from |OnResponseCompleted|. |
| 50 bool CompleteResponseStarted(int request_id, bool in_complete); | 51 bool CompleteResponseStarted(int request_id, bool in_complete); |
| 51 | 52 |
| 53 // Returns true if we have to wait until the plugin list is generated. |
| 54 bool ShouldWaitForPlugins(); |
| 55 |
| 56 // A test to determining whether the request should be forwarded to the |
| 57 // download thread. If need_plugin_list was passed in and was set to true, |
| 58 // that means that the check couldn't be fully done because the plugins aren't |
| 59 // loaded. The function should be called again after the plugin list is |
| 60 // loaded. |
| 61 bool ShouldDownload(bool* need_plugin_list); |
| 62 |
| 63 // Called on the file thread to load the list of plugins. |
| 64 void LoadPlugins(); |
| 65 |
| 66 // Called on the IO thread once the list of plugins has been loaded. |
| 67 void OnPluginsLoaded(); |
| 68 |
| 52 scoped_refptr<ResourceHandler> real_handler_; | 69 scoped_refptr<ResourceHandler> real_handler_; |
| 53 scoped_refptr<ResourceResponse> response_; | 70 scoped_refptr<ResourceResponse> response_; |
| 54 ResourceDispatcherHost* host_; | 71 ResourceDispatcherHost* host_; |
| 55 URLRequest* request_; | 72 URLRequest* request_; |
| 56 scoped_refptr<net::IOBuffer> read_buffer_; | 73 scoped_refptr<net::IOBuffer> read_buffer_; |
| 57 scoped_refptr<net::IOBuffer> my_buffer_; | 74 scoped_refptr<net::IOBuffer> my_buffer_; |
| 58 int read_buffer_size_; | 75 int read_buffer_size_; |
| 59 int bytes_read_; | 76 int bytes_read_; |
| 60 bool sniff_content_; | 77 bool sniff_content_; |
| 61 bool should_buffer_; | 78 bool should_buffer_; |
| 79 bool wait_for_plugins_; |
| 62 bool buffering_; | 80 bool buffering_; |
| 63 bool finished_; | 81 bool finished_; |
| 64 | 82 |
| 65 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 83 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
| 66 }; | 84 }; |
| 67 | 85 |
| 68 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 86 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
| OLD | NEW |