OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/sync_resource_handler.h" | 5 #include "content/browser/renderer_host/sync_resource_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/debugger/devtools_netlog_observer.h" | 8 #include "content/browser/debugger/devtools_netlog_observer.h" |
9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 9 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
10 #include "content/browser/renderer_host/resource_message_filter.h" | 10 #include "content/browser/renderer_host/resource_message_filter.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) { | 54 if (new_url.GetOrigin() != result_.final_url.GetOrigin()) { |
55 LOG(ERROR) << "Cross origin redirect denied"; | 55 LOG(ERROR) << "Cross origin redirect denied"; |
56 return false; | 56 return false; |
57 } | 57 } |
58 result_.final_url = new_url; | 58 result_.final_url = new_url; |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 bool SyncResourceHandler::OnResponseStarted( | 62 bool SyncResourceHandler::OnResponseStarted( |
63 int request_id, | 63 int request_id, |
64 ResourceResponse* response) { | 64 ResourceResponse* response, |
| 65 bool* defer) { |
65 net::URLRequest* request = rdh_->GetURLRequest( | 66 net::URLRequest* request = rdh_->GetURLRequest( |
66 GlobalRequestID(filter_->child_id(), request_id)); | 67 GlobalRequestID(filter_->child_id(), request_id)); |
67 if (rdh_->delegate()) | 68 if (rdh_->delegate()) |
68 rdh_->delegate()->OnResponseStarted(request, response, filter_); | 69 rdh_->delegate()->OnResponseStarted(request, response, filter_); |
69 | 70 |
70 DevToolsNetLogObserver::PopulateResponseInfo(request, response); | 71 DevToolsNetLogObserver::PopulateResponseInfo(request, response); |
71 | 72 |
72 // We don't care about copying the status here. | 73 // We don't care about copying the status here. |
73 result_.headers = response->headers; | 74 result_.headers = response->headers; |
74 result_.mime_type = response->mime_type; | 75 result_.mime_type = response->mime_type; |
(...skipping 15 matching lines...) Expand all Loading... |
90 } | 91 } |
91 | 92 |
92 bool SyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, | 93 bool SyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, |
93 int* buf_size, int min_size) { | 94 int* buf_size, int min_size) { |
94 DCHECK(min_size == -1); | 95 DCHECK(min_size == -1); |
95 *buf = read_buffer_.get(); | 96 *buf = read_buffer_.get(); |
96 *buf_size = kReadBufSize; | 97 *buf_size = kReadBufSize; |
97 return true; | 98 return true; |
98 } | 99 } |
99 | 100 |
100 bool SyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { | 101 bool SyncResourceHandler::OnReadCompleted(int request_id, int* bytes_read, |
| 102 bool* defer) { |
101 if (!*bytes_read) | 103 if (!*bytes_read) |
102 return true; | 104 return true; |
103 result_.data.append(read_buffer_->data(), *bytes_read); | 105 result_.data.append(read_buffer_->data(), *bytes_read); |
104 return true; | 106 return true; |
105 } | 107 } |
106 | 108 |
107 bool SyncResourceHandler::OnResponseCompleted( | 109 bool SyncResourceHandler::OnResponseCompleted( |
108 int request_id, | 110 int request_id, |
109 const net::URLRequestStatus& status, | 111 const net::URLRequestStatus& status, |
110 const std::string& security_info) { | 112 const std::string& security_info) { |
(...skipping 12 matching lines...) Expand all Loading... |
123 | 125 |
124 void SyncResourceHandler::OnRequestClosed() { | 126 void SyncResourceHandler::OnRequestClosed() { |
125 if (!result_message_) | 127 if (!result_message_) |
126 return; | 128 return; |
127 | 129 |
128 result_message_->set_reply_error(); | 130 result_message_->set_reply_error(); |
129 filter_->Send(result_message_); | 131 filter_->Send(result_message_); |
130 } | 132 } |
131 | 133 |
132 } // namespace content | 134 } // namespace content |
OLD | NEW |