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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2042483002: Fix web_accesible_resources enforcement for Site Isolation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/frame_tree_node.h" 9 #include "content/browser/frame_host/frame_tree_node.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 DCHECK(state_ != DEFERRING_START || next_index_ != 0); 409 DCHECK(state_ != DEFERRING_START || next_index_ != 0);
410 for (size_t i = next_index_; i < throttles_.size(); ++i) { 410 for (size_t i = next_index_; i < throttles_.size(); ++i) {
411 NavigationThrottle::ThrottleCheckResult result = 411 NavigationThrottle::ThrottleCheckResult result =
412 throttles_[i]->WillStartRequest(); 412 throttles_[i]->WillStartRequest();
413 switch (result) { 413 switch (result) {
414 case NavigationThrottle::PROCEED: 414 case NavigationThrottle::PROCEED:
415 continue; 415 continue;
416 416
417 case NavigationThrottle::CANCEL: 417 case NavigationThrottle::CANCEL:
418 case NavigationThrottle::CANCEL_AND_IGNORE: 418 case NavigationThrottle::CANCEL_AND_IGNORE:
419 case NavigationThrottle::BLOCK_REQUEST:
419 state_ = CANCELING; 420 state_ = CANCELING;
420 return result; 421 return result;
421 422
422 case NavigationThrottle::DEFER: 423 case NavigationThrottle::DEFER:
423 state_ = DEFERRING_START; 424 state_ = DEFERRING_START;
424 next_index_ = i + 1; 425 next_index_ = i + 1;
425 return result; 426 return result;
426
427 default:
428 NOTREACHED();
429 } 427 }
430 } 428 }
431 next_index_ = 0; 429 next_index_ = 0;
432 state_ = WILL_SEND_REQUEST; 430 state_ = WILL_SEND_REQUEST;
433 return NavigationThrottle::PROCEED; 431 return NavigationThrottle::PROCEED;
434 } 432 }
435 433
436 NavigationThrottle::ThrottleCheckResult 434 NavigationThrottle::ThrottleCheckResult
437 NavigationHandleImpl::CheckWillRedirectRequest() { 435 NavigationHandleImpl::CheckWillRedirectRequest() {
438 DCHECK(state_ == WILL_REDIRECT_REQUEST || state_ == DEFERRING_REDIRECT); 436 DCHECK(state_ == WILL_REDIRECT_REQUEST || state_ == DEFERRING_REDIRECT);
439 DCHECK(state_ != WILL_REDIRECT_REQUEST || next_index_ == 0); 437 DCHECK(state_ != WILL_REDIRECT_REQUEST || next_index_ == 0);
440 DCHECK(state_ != DEFERRING_REDIRECT || next_index_ != 0); 438 DCHECK(state_ != DEFERRING_REDIRECT || next_index_ != 0);
441 for (size_t i = next_index_; i < throttles_.size(); ++i) { 439 for (size_t i = next_index_; i < throttles_.size(); ++i) {
442 NavigationThrottle::ThrottleCheckResult result = 440 NavigationThrottle::ThrottleCheckResult result =
443 throttles_[i]->WillRedirectRequest(); 441 throttles_[i]->WillRedirectRequest();
444 switch (result) { 442 switch (result) {
445 case NavigationThrottle::PROCEED: 443 case NavigationThrottle::PROCEED:
446 continue; 444 continue;
447 445
448 case NavigationThrottle::CANCEL: 446 case NavigationThrottle::CANCEL:
449 case NavigationThrottle::CANCEL_AND_IGNORE: 447 case NavigationThrottle::CANCEL_AND_IGNORE:
450 state_ = CANCELING; 448 state_ = CANCELING;
451 return result; 449 return result;
452 450
453 case NavigationThrottle::DEFER: 451 case NavigationThrottle::DEFER:
454 state_ = DEFERRING_REDIRECT; 452 state_ = DEFERRING_REDIRECT;
455 next_index_ = i + 1; 453 next_index_ = i + 1;
456 return result; 454 return result;
457 455
458 default: 456 case NavigationThrottle::BLOCK_REQUEST:
459 NOTREACHED(); 457 NOTREACHED();
460 } 458 }
461 } 459 }
462 next_index_ = 0; 460 next_index_ = 0;
463 state_ = WILL_REDIRECT_REQUEST; 461 state_ = WILL_REDIRECT_REQUEST;
464 462
465 // Notify the delegate that a redirect was encountered and will be followed. 463 // Notify the delegate that a redirect was encountered and will be followed.
466 if (GetDelegate()) 464 if (GetDelegate())
467 GetDelegate()->DidRedirectNavigation(this); 465 GetDelegate()->DidRedirectNavigation(this);
468 466
(...skipping 14 matching lines...) Expand all
483 481
484 case NavigationThrottle::CANCEL: 482 case NavigationThrottle::CANCEL:
485 case NavigationThrottle::CANCEL_AND_IGNORE: 483 case NavigationThrottle::CANCEL_AND_IGNORE:
486 state_ = CANCELING; 484 state_ = CANCELING;
487 return result; 485 return result;
488 486
489 case NavigationThrottle::DEFER: 487 case NavigationThrottle::DEFER:
490 state_ = DEFERRING_RESPONSE; 488 state_ = DEFERRING_RESPONSE;
491 next_index_ = i + 1; 489 next_index_ = i + 1;
492 return result; 490 return result;
491
492 case NavigationThrottle::BLOCK_REQUEST:
493 NOTREACHED();
493 } 494 }
494 } 495 }
495 next_index_ = 0; 496 next_index_ = 0;
496 state_ = WILL_PROCESS_RESPONSE; 497 state_ = WILL_PROCESS_RESPONSE;
497 return NavigationThrottle::PROCEED; 498 return NavigationThrottle::PROCEED;
498 } 499 }
499 500
500 void NavigationHandleImpl::RunCompleteCallback( 501 void NavigationHandleImpl::RunCompleteCallback(
501 NavigationThrottle::ThrottleCheckResult result) { 502 NavigationThrottle::ThrottleCheckResult result) {
502 DCHECK(result != NavigationThrottle::DEFER); 503 DCHECK(result != NavigationThrottle::DEFER);
503 504
504 ThrottleChecksFinishedCallback callback = complete_callback_; 505 ThrottleChecksFinishedCallback callback = complete_callback_;
505 complete_callback_.Reset(); 506 complete_callback_.Reset();
506 507
507 if (!callback.is_null()) 508 if (!callback.is_null())
508 callback.Run(result); 509 callback.Run(result);
509 510
510 // No code after running the callback, as it might have resulted in our 511 // No code after running the callback, as it might have resulted in our
511 // destruction. 512 // destruction.
512 } 513 }
513 514
514 } // namespace content 515 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698