| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/cross_site_resource_handler.h" | 7 #include "content/browser/renderer_host/cross_site_resource_handler.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 completed_during_transition_ = true; | 137 completed_during_transition_ = true; |
| 138 completed_status_ = status; | 138 completed_status_ = status; |
| 139 completed_security_info_ = security_info; | 139 completed_security_info_ = security_info; |
| 140 | 140 |
| 141 // Return false to tell RDH not to notify the world or clean up the | 141 // Return false to tell RDH not to notify the world or clean up the |
| 142 // pending request. We will do so in ResumeResponse. | 142 // pending request. We will do so in ResumeResponse. |
| 143 return false; | 143 return false; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // We can now send the response to the new renderer, which will cause | 146 // We can now send the response to the new renderer, which will cause |
| 147 // TabContents to swap in the new renderer and destroy the old one. | 147 // WebContentsImpl to swap in the new renderer and destroy the old one. |
| 148 void CrossSiteResourceHandler::ResumeResponse() { | 148 void CrossSiteResourceHandler::ResumeResponse() { |
| 149 DCHECK(request_id_ != -1); | 149 DCHECK(request_id_ != -1); |
| 150 DCHECK(in_cross_site_transition_); | 150 DCHECK(in_cross_site_transition_); |
| 151 in_cross_site_transition_ = false; | 151 in_cross_site_transition_ = false; |
| 152 | 152 |
| 153 // Find the request for this response. | 153 // Find the request for this response. |
| 154 GlobalRequestID global_id(render_process_host_id_, request_id_); | 154 GlobalRequestID global_id(render_process_host_id_, request_id_); |
| 155 net::URLRequest* request = rdh_->GetURLRequest(global_id); | 155 net::URLRequest* request = rdh_->GetURLRequest(global_id); |
| 156 if (!request) { | 156 if (!request) { |
| 157 DLOG(WARNING) << "Resuming a request that wasn't found"; | 157 DLOG(WARNING) << "Resuming a request that wasn't found"; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 if (has_started_response_) { | 208 if (has_started_response_) { |
| 209 // Pause the request until the old renderer is finished and the new | 209 // Pause the request until the old renderer is finished and the new |
| 210 // renderer is ready. | 210 // renderer is ready. |
| 211 rdh_->PauseRequest(render_process_host_id_, request_id, true); | 211 rdh_->PauseRequest(render_process_host_id_, request_id, true); |
| 212 } | 212 } |
| 213 // If our OnResponseStarted wasn't called, then we're being called by | 213 // If our OnResponseStarted wasn't called, then we're being called by |
| 214 // OnResponseCompleted after a failure. We don't need to pause, because | 214 // OnResponseCompleted after a failure. We don't need to pause, because |
| 215 // there will be no reads. | 215 // there will be no reads. |
| 216 | 216 |
| 217 // Tell the tab responsible for this request that a cross-site response is | 217 // Tell the contents responsible for this request that a cross-site response |
| 218 // starting, so that it can tell its old renderer to run its onunload | 218 // is starting, so that it can tell its old renderer to run its onunload |
| 219 // handler now. We will wait to hear the corresponding ClosePage_ACK. | 219 // handler now. We will wait to hear the corresponding ClosePage_ACK. |
| 220 BrowserThread::PostTask( | 220 BrowserThread::PostTask( |
| 221 BrowserThread::UI, | 221 BrowserThread::UI, |
| 222 FROM_HERE, | 222 FROM_HERE, |
| 223 base::Bind( | 223 base::Bind( |
| 224 &OnCrossSiteResponseHelper, | 224 &OnCrossSiteResponseHelper, |
| 225 render_process_host_id_, | 225 render_process_host_id_, |
| 226 render_view_id_, | 226 render_view_id_, |
| 227 request_id)); | 227 request_id)); |
| 228 | 228 |
| 229 // TODO(creis): If the above call should fail, then we need to notify the IO | 229 // TODO(creis): If the above call should fail, then we need to notify the IO |
| 230 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. | 230 // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace content | 233 } // namespace content |
| OLD | NEW |