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_SYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 8 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
9 #include "chrome/browser/renderer_host/resource_handler.h" | 9 #include "chrome/browser/renderer_host/resource_handler.h" |
| 10 #include "net/base/io_buffer.h" |
10 | 11 |
11 // Used to complete a synchronous resource request in response to resource load | 12 // Used to complete a synchronous resource request in response to resource load |
12 // events from the resource dispatcher host. | 13 // events from the resource dispatcher host. |
13 class SyncResourceHandler : public ResourceHandler { | 14 class SyncResourceHandler : public ResourceHandler { |
14 public: | 15 public: |
15 SyncResourceHandler(ResourceDispatcherHost::Receiver* receiver, | 16 SyncResourceHandler(ResourceDispatcherHost::Receiver* receiver, |
16 const GURL& url, | 17 const GURL& url, |
17 IPC::Message* result_message); | 18 IPC::Message* result_message); |
18 | 19 |
19 bool OnRequestRedirected(int request_id, const GURL& new_url); | 20 bool OnRequestRedirected(int request_id, const GURL& new_url); |
20 bool OnResponseStarted(int request_id, ResourceResponse* response); | 21 bool OnResponseStarted(int request_id, ResourceResponse* response); |
21 bool OnWillRead(int request_id, char** buf, int* buf_size, int min_size); | 22 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 23 int min_size); |
22 bool OnReadCompleted(int request_id, int* bytes_read); | 24 bool OnReadCompleted(int request_id, int* bytes_read); |
23 bool OnResponseCompleted(int request_id, const URLRequestStatus& status); | 25 bool OnResponseCompleted(int request_id, const URLRequestStatus& status); |
24 | 26 |
25 private: | 27 private: |
26 enum { kReadBufSize = 3840 }; | 28 enum { kReadBufSize = 3840 }; |
27 char read_buffer_[kReadBufSize]; | 29 scoped_refptr<net::IOBuffer> read_buffer_; |
28 | 30 |
29 ViewHostMsg_SyncLoad_Result result_; | 31 ViewHostMsg_SyncLoad_Result result_; |
30 ResourceDispatcherHost::Receiver* receiver_; | 32 ResourceDispatcherHost::Receiver* receiver_; |
31 IPC::Message* result_message_; | 33 IPC::Message* result_message_; |
32 }; | 34 }; |
33 | 35 |
34 #endif // CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ | 36 #endif // CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |