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