Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: content/browser/loader/cross_site_resource_handler.cc

Issue 498553004: Remove implicit conversions from scoped_refptr to T* in content/browser/loader/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/loader/detachable_resource_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/loader/cross_site_resource_handler.h" 5 #include "content/browser/loader/cross_site_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 ResourceRequestInfoImpl* info = GetRequestInfo(); 143 ResourceRequestInfoImpl* info = GetRequestInfo();
144 info->set_cross_site_handler(this); 144 info->set_cross_site_handler(this);
145 145
146 TransitionLayerData transition_data; 146 TransitionLayerData transition_data;
147 bool is_navigation_transition = 147 bool is_navigation_transition =
148 TransitionRequestManager::GetInstance()->HasPendingTransitionRequest( 148 TransitionRequestManager::GetInstance()->HasPendingTransitionRequest(
149 info->GetChildID(), info->GetRenderFrameID(), request()->url(), 149 info->GetChildID(), info->GetRenderFrameID(), request()->url(),
150 &transition_data); 150 &transition_data);
151 151
152 if (is_navigation_transition) { 152 if (is_navigation_transition) {
153 if (response_) 153 if (response_.get())
154 transition_data.response_headers = response_->head.headers; 154 transition_data.response_headers = response_->head.headers;
155 transition_data.request_url = request()->url(); 155 transition_data.request_url = request()->url();
156 156
157 return OnNavigationTransitionResponseStarted(response, defer, 157 return OnNavigationTransitionResponseStarted(response, defer,
158 transition_data); 158 transition_data);
159 } else { 159 } else {
160 return OnNormalResponseStarted(response, defer); 160 return OnNormalResponseStarted(response, defer);
161 } 161 }
162 } 162 }
163 163
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 render_frame_id, 242 render_frame_id,
243 transition_data)); 243 transition_data));
244 244
245 *defer = true; 245 *defer = true;
246 OnDidDefer(); 246 OnDidDefer();
247 return true; 247 return true;
248 } 248 }
249 249
250 void CrossSiteResourceHandler::ResumeResponseDeferredAtStart(int request_id) { 250 void CrossSiteResourceHandler::ResumeResponseDeferredAtStart(int request_id) {
251 bool defer = false; 251 bool defer = false;
252 if (!OnNormalResponseStarted(response_, &defer)) { 252 if (!OnNormalResponseStarted(response_.get(), &defer)) {
253 controller()->Cancel(); 253 controller()->Cancel();
254 } else if (!defer) { 254 } else if (!defer) {
255 ResumeIfDeferred(); 255 ResumeIfDeferred();
256 } 256 }
257 } 257 }
258 258
259 void CrossSiteResourceHandler::ResumeOrTransfer(bool is_transfer) { 259 void CrossSiteResourceHandler::ResumeOrTransfer(bool is_transfer) {
260 if (is_transfer) { 260 if (is_transfer) {
261 StartCrossSiteTransition(response_); 261 StartCrossSiteTransition(response_.get());
262 } else { 262 } else {
263 ResumeResponse(); 263 ResumeResponse();
264 } 264 }
265 } 265 }
266 266
267 bool CrossSiteResourceHandler::OnReadCompleted(int bytes_read, bool* defer) { 267 bool CrossSiteResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
268 CHECK(!in_cross_site_transition_); 268 CHECK(!in_cross_site_transition_);
269 return next_handler_->OnReadCompleted(bytes_read, defer); 269 return next_handler_->OnReadCompleted(bytes_read, defer);
270 } 270 }
271 271
(...skipping 20 matching lines...) Expand all
292 292
293 // We can now send the response to the new renderer, which will cause 293 // We can now send the response to the new renderer, which will cause
294 // WebContentsImpl to swap in the new renderer and destroy the old one. 294 // WebContentsImpl to swap in the new renderer and destroy the old one.
295 void CrossSiteResourceHandler::ResumeResponse() { 295 void CrossSiteResourceHandler::ResumeResponse() {
296 DCHECK(request()); 296 DCHECK(request());
297 in_cross_site_transition_ = false; 297 in_cross_site_transition_ = false;
298 ResourceRequestInfoImpl* info = GetRequestInfo(); 298 ResourceRequestInfoImpl* info = GetRequestInfo();
299 299
300 if (has_started_response_) { 300 if (has_started_response_) {
301 // Send OnResponseStarted to the new renderer. 301 // Send OnResponseStarted to the new renderer.
302 DCHECK(response_); 302 DCHECK(response_.get());
303 bool defer = false; 303 bool defer = false;
304 if (!next_handler_->OnResponseStarted(response_.get(), &defer)) { 304 if (!next_handler_->OnResponseStarted(response_.get(), &defer)) {
305 controller()->Cancel(); 305 controller()->Cancel();
306 } else if (!defer) { 306 } else if (!defer) {
307 // Unpause the request to resume reading. Any further reads will be 307 // Unpause the request to resume reading. Any further reads will be
308 // directed toward the new renderer. 308 // directed toward the new renderer.
309 ResumeIfDeferred(); 309 ResumeIfDeferred();
310 } 310 }
311 } 311 }
312 312
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 controller()->Resume(); 412 controller()->Resume();
413 } 413 }
414 } 414 }
415 415
416 void CrossSiteResourceHandler::OnDidDefer() { 416 void CrossSiteResourceHandler::OnDidDefer() {
417 did_defer_ = true; 417 did_defer_ = true;
418 request()->LogBlockedBy("CrossSiteResourceHandler"); 418 request()->LogBlockedBy("CrossSiteResourceHandler");
419 } 419 }
420 420
421 } // namespace content 421 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/detachable_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698