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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | |
12 #include "chrome/browser/renderer_host/resource_handler.h" | 11 #include "chrome/browser/renderer_host/resource_handler.h" |
13 #include "chrome/common/resource_response.h" | 12 #include "chrome/common/resource_response.h" |
14 | 13 |
| 14 class ResourceDispatcherHost; |
| 15 class ResourceMessageFilter; |
| 16 |
| 17 namespace IPC { |
| 18 class Message; |
| 19 } |
| 20 |
15 namespace net { | 21 namespace net { |
16 class IOBuffer; | 22 class IOBuffer; |
17 } | 23 } |
18 | 24 |
19 // Used to complete a synchronous resource request in response to resource load | 25 // Used to complete a synchronous resource request in response to resource load |
20 // events from the resource dispatcher host. | 26 // events from the resource dispatcher host. |
21 class SyncResourceHandler : public ResourceHandler { | 27 class SyncResourceHandler : public ResourceHandler { |
22 public: | 28 public: |
23 SyncResourceHandler(ResourceDispatcherHost::Receiver* receiver, | 29 SyncResourceHandler(ResourceMessageFilter* filter, |
24 int process_id, | |
25 const GURL& url, | 30 const GURL& url, |
26 IPC::Message* result_message, | 31 IPC::Message* result_message, |
27 ResourceDispatcherHost* resource_dispatcher_host); | 32 ResourceDispatcherHost* resource_dispatcher_host); |
28 | 33 |
29 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 34 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
30 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 35 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
31 ResourceResponse* response, bool* defer); | 36 ResourceResponse* response, bool* defer); |
32 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 37 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); |
33 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 38 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
34 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 39 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
35 int min_size); | 40 int min_size); |
36 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 41 virtual bool OnReadCompleted(int request_id, int* bytes_read); |
37 virtual bool OnResponseCompleted(int request_id, | 42 virtual bool OnResponseCompleted(int request_id, |
38 const URLRequestStatus& status, | 43 const URLRequestStatus& status, |
39 const std::string& security_info); | 44 const std::string& security_info); |
40 virtual void OnRequestClosed(); | 45 virtual void OnRequestClosed(); |
41 | 46 |
42 private: | 47 private: |
43 enum { kReadBufSize = 3840 }; | 48 enum { kReadBufSize = 3840 }; |
44 | 49 |
45 ~SyncResourceHandler(); | 50 ~SyncResourceHandler(); |
46 | 51 |
47 scoped_refptr<net::IOBuffer> read_buffer_; | 52 scoped_refptr<net::IOBuffer> read_buffer_; |
48 | 53 |
49 SyncLoadResult result_; | 54 SyncLoadResult result_; |
50 ResourceDispatcherHost::Receiver* receiver_; | 55 ResourceMessageFilter* filter_; |
51 int process_id_; | |
52 IPC::Message* result_message_; | 56 IPC::Message* result_message_; |
53 ResourceDispatcherHost* rdh_; | 57 ResourceDispatcherHost* rdh_; |
54 }; | 58 }; |
55 | 59 |
56 #endif // CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ | 60 #endif // CHROME_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |