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