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_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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // Used to buffer a request until enough data has been received. | 25 // Used to buffer a request until enough data has been received. |
26 class BufferedResourceHandler : public LayeredResourceHandler { | 26 class BufferedResourceHandler : public LayeredResourceHandler { |
27 public: | 27 public: |
28 BufferedResourceHandler(ResourceHandler* handler, | 28 BufferedResourceHandler(ResourceHandler* handler, |
29 ResourceDispatcherHost* host, | 29 ResourceDispatcherHost* host, |
30 net::URLRequest* request); | 30 net::URLRequest* request); |
31 | 31 |
32 // ResourceHandler implementation: | 32 // ResourceHandler implementation: |
33 virtual bool OnResponseStarted(int request_id, | 33 virtual bool OnResponseStarted(int request_id, |
34 content::ResourceResponse* response) OVERRIDE; | 34 ResourceResponse* response) OVERRIDE; |
35 virtual bool OnWillRead(int request_id, | 35 virtual bool OnWillRead(int request_id, |
36 net::IOBuffer** buf, | 36 net::IOBuffer** buf, |
37 int* buf_size, | 37 int* buf_size, |
38 int min_size) OVERRIDE; | 38 int min_size) OVERRIDE; |
39 virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; | 39 virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; |
40 virtual void OnRequestClosed() OVERRIDE; | 40 virtual void OnRequestClosed() OVERRIDE; |
41 | 41 |
42 private: | 42 private: |
43 virtual ~BufferedResourceHandler(); | 43 virtual ~BufferedResourceHandler(); |
44 | 44 |
(...skipping 28 matching lines...) Expand all Loading... |
73 // Forwards any queued events to |next_handler_|. Returns false to indicate | 73 // Forwards any queued events to |next_handler_|. Returns false to indicate |
74 // an error, which will result in the request being cancelled. | 74 // an error, which will result in the request being cancelled. |
75 bool ForwardPendingEventsToNextHandler(int request_id); | 75 bool ForwardPendingEventsToNextHandler(int request_id); |
76 | 76 |
77 // Copies data from |read_buffer_| to |next_handler_|. | 77 // Copies data from |read_buffer_| to |next_handler_|. |
78 void CopyReadBufferToNextHandler(int request_id); | 78 void CopyReadBufferToNextHandler(int request_id); |
79 | 79 |
80 // Called on the IO thread once the list of plugins has been loaded. | 80 // Called on the IO thread once the list of plugins has been loaded. |
81 void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins); | 81 void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins); |
82 | 82 |
83 scoped_refptr<content::ResourceResponse> response_; | 83 scoped_refptr<ResourceResponse> response_; |
84 ResourceDispatcherHost* host_; | 84 ResourceDispatcherHost* host_; |
85 net::URLRequest* request_; | 85 net::URLRequest* request_; |
86 scoped_refptr<net::IOBuffer> read_buffer_; | 86 scoped_refptr<net::IOBuffer> read_buffer_; |
87 scoped_refptr<net::IOBuffer> my_buffer_; | 87 scoped_refptr<net::IOBuffer> my_buffer_; |
88 int read_buffer_size_; | 88 int read_buffer_size_; |
89 int bytes_read_; | 89 int bytes_read_; |
90 bool sniff_content_; | 90 bool sniff_content_; |
91 bool wait_for_plugins_; | 91 bool wait_for_plugins_; |
92 bool buffering_; | 92 bool buffering_; |
93 bool next_handler_needs_response_started_; | 93 bool next_handler_needs_response_started_; |
94 bool next_handler_needs_will_read_; | 94 bool next_handler_needs_will_read_; |
95 bool finished_; | 95 bool finished_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 97 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace content | 100 } // namespace content |
101 | 101 |
102 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ | 102 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ |
OLD | NEW |