| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "chrome/browser/renderer_host/sync_resource_handler.h" | 5 #include "chrome/browser/renderer_host/sync_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/debugger/devtools_netlog_observer.h" | 8 #include "chrome/browser/debugger/devtools_netlog_observer.h" |
| 9 #include "chrome/browser/net/load_timing_observer.h" | 9 #include "chrome/browser/net/load_timing_observer.h" |
| 10 #include "chrome/browser/renderer_host/global_request_id.h" | 10 #include "chrome/browser/renderer_host/global_request_id.h" |
| 11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 bool SyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { | 92 bool SyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { |
| 93 if (!*bytes_read) | 93 if (!*bytes_read) |
| 94 return true; | 94 return true; |
| 95 result_.data.append(read_buffer_->data(), *bytes_read); | 95 result_.data.append(read_buffer_->data(), *bytes_read); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool SyncResourceHandler::OnResponseCompleted( | 99 bool SyncResourceHandler::OnResponseCompleted( |
| 100 int request_id, | 100 int request_id, |
| 101 const URLRequestStatus& status, | 101 const net::URLRequestStatus& status, |
| 102 const std::string& security_info) { | 102 const std::string& security_info) { |
| 103 result_.status = status; | 103 result_.status = status; |
| 104 | 104 |
| 105 ViewHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); | 105 ViewHostMsg_SyncLoad::WriteReplyParams(result_message_, result_); |
| 106 filter_->Send(result_message_); | 106 filter_->Send(result_message_); |
| 107 result_message_ = NULL; | 107 result_message_ = NULL; |
| 108 return true; | 108 return true; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SyncResourceHandler::OnRequestClosed() { | 111 void SyncResourceHandler::OnRequestClosed() { |
| 112 if (!result_message_) | 112 if (!result_message_) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 result_message_->set_reply_error(); | 115 result_message_->set_reply_error(); |
| 116 filter_->Send(result_message_); | 116 filter_->Send(result_message_); |
| 117 } | 117 } |
| OLD | NEW |