OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_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 "content/browser/renderer_host/resource_handler.h" | 11 #include "content/browser/renderer_host/resource_handler.h" |
12 #include "content/common/resource_response.h" | 12 #include "content/public/common/resource_response.h" |
13 | 13 |
14 class ResourceDispatcherHost; | 14 class ResourceDispatcherHost; |
15 class ResourceMessageFilter; | 15 class ResourceMessageFilter; |
16 | 16 |
17 namespace IPC { | 17 namespace IPC { |
18 class Message; | 18 class Message; |
19 } | 19 } |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class IOBuffer; | 22 class IOBuffer; |
23 } | 23 } |
24 | 24 |
25 // 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 |
26 // events from the resource dispatcher host. | 26 // events from the resource dispatcher host. |
27 class SyncResourceHandler : public ResourceHandler { | 27 class SyncResourceHandler : public ResourceHandler { |
28 public: | 28 public: |
29 SyncResourceHandler(ResourceMessageFilter* filter, | 29 SyncResourceHandler(ResourceMessageFilter* filter, |
30 const GURL& url, | 30 const GURL& url, |
31 IPC::Message* result_message, | 31 IPC::Message* result_message, |
32 ResourceDispatcherHost* resource_dispatcher_host); | 32 ResourceDispatcherHost* resource_dispatcher_host); |
33 | 33 |
34 virtual bool OnUploadProgress(int request_id, | 34 virtual bool OnUploadProgress(int request_id, |
35 uint64 position, | 35 uint64 position, |
36 uint64 size) OVERRIDE; | 36 uint64 size) OVERRIDE; |
37 virtual bool OnRequestRedirected(int request_id, | 37 virtual bool OnRequestRedirected(int request_id, |
38 const GURL& new_url, | 38 const GURL& new_url, |
39 ResourceResponse* response, | 39 content::ResourceResponse* response, |
40 bool* defer) OVERRIDE; | 40 bool* defer) OVERRIDE; |
41 virtual bool OnResponseStarted(int request_id, | 41 virtual bool OnResponseStarted(int request_id, |
42 ResourceResponse* response) OVERRIDE; | 42 content::ResourceResponse* response) OVERRIDE; |
43 virtual bool OnWillStart(int request_id, | 43 virtual bool OnWillStart(int request_id, |
44 const GURL& url, | 44 const GURL& url, |
45 bool* defer) OVERRIDE; | 45 bool* defer) OVERRIDE; |
46 virtual bool OnWillRead(int request_id, | 46 virtual bool OnWillRead(int request_id, |
47 net::IOBuffer** buf, | 47 net::IOBuffer** buf, |
48 int* buf_size, | 48 int* buf_size, |
49 int min_size) OVERRIDE; | 49 int min_size) OVERRIDE; |
50 virtual bool OnReadCompleted(int request_id, | 50 virtual bool OnReadCompleted(int request_id, |
51 int* bytes_read) OVERRIDE; | 51 int* bytes_read) OVERRIDE; |
52 virtual bool OnResponseCompleted(int request_id, | 52 virtual bool OnResponseCompleted(int request_id, |
53 const net::URLRequestStatus& status, | 53 const net::URLRequestStatus& status, |
54 const std::string& security_info) OVERRIDE; | 54 const std::string& security_info) OVERRIDE; |
55 virtual void OnRequestClosed() OVERRIDE; | 55 virtual void OnRequestClosed() OVERRIDE; |
56 | 56 |
57 private: | 57 private: |
58 enum { kReadBufSize = 3840 }; | 58 enum { kReadBufSize = 3840 }; |
59 | 59 |
60 virtual ~SyncResourceHandler(); | 60 virtual ~SyncResourceHandler(); |
61 | 61 |
62 scoped_refptr<net::IOBuffer> read_buffer_; | 62 scoped_refptr<net::IOBuffer> read_buffer_; |
63 | 63 |
64 SyncLoadResult result_; | 64 content::SyncLoadResult result_; |
65 ResourceMessageFilter* filter_; | 65 ResourceMessageFilter* filter_; |
66 IPC::Message* result_message_; | 66 IPC::Message* result_message_; |
67 ResourceDispatcherHost* rdh_; | 67 ResourceDispatcherHost* rdh_; |
68 }; | 68 }; |
69 | 69 |
70 #endif // CONTENT_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ | 70 #endif // CONTENT_BROWSER_RENDERER_HOST_SYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |