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

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

Issue 746993003: Only cancel navigation on user gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 render_frame_host_->ClearPendingTransitionRequestData(); 411 render_frame_host_->ClearPendingTransitionRequestData();
412 412
413 response_started_id_.reset(); 413 response_started_id_.reset();
414 } 414 }
415 415
416 void RenderFrameHostManager::ClearNavigationTransitionData() { 416 void RenderFrameHostManager::ClearNavigationTransitionData() {
417 render_frame_host_->ClearPendingTransitionRequestData(); 417 render_frame_host_->ClearPendingTransitionRequestData();
418 } 418 }
419 419
420 void RenderFrameHostManager::DidNavigateFrame( 420 void RenderFrameHostManager::DidNavigateFrame(
421 RenderFrameHostImpl* render_frame_host) { 421 RenderFrameHostImpl* render_frame_host,
422 bool was_within_same_page) {
422 if (!cross_navigation_pending_) { 423 if (!cross_navigation_pending_) {
423 DCHECK(!pending_render_frame_host_); 424 DCHECK(!pending_render_frame_host_);
424 425
425 // We should only hear this from our current renderer. 426 // We should only hear this from our current renderer.
426 DCHECK_EQ(render_frame_host_, render_frame_host); 427 DCHECK_EQ(render_frame_host_, render_frame_host);
427 428
428 // Even when there is no pending RVH, there may be a pending Web UI. 429 // Even when there is no pending RVH, there may be a pending Web UI.
429 if (pending_web_ui()) 430 if (pending_web_ui())
430 CommitPending(); 431 CommitPending();
431 return; 432 return;
432 } 433 }
433 434
434 if (render_frame_host == pending_render_frame_host_) { 435 if (render_frame_host == pending_render_frame_host_) {
435 // The pending cross-site navigation completed, so show the renderer. 436 // The pending cross-site navigation completed, so show the renderer.
436 CommitPending(); 437 CommitPending();
437 cross_navigation_pending_ = false; 438 cross_navigation_pending_ = false;
438 } else if (render_frame_host == render_frame_host_) { 439 } else if (render_frame_host == render_frame_host_ &&
440 !was_within_same_page) {
Charlie Reis 2014/12/02 18:03:33 This wouldn't be the right place to do this. It o
439 // A navigation in the original page has taken place. Cancel the pending 441 // A navigation in the original page has taken place. Cancel the pending
440 // one. 442 // one.
441 CancelPending(); 443 CancelPending();
442 cross_navigation_pending_ = false; 444 cross_navigation_pending_ = false;
443 } else { 445 } else {
444 // No one else should be sending us DidNavigate in this state. 446 // No one else should be sending us DidNavigate in this state.
445 DCHECK(false); 447 DCHECK(was_within_same_page);
446 } 448 }
447 } 449 }
448 450
449 void RenderFrameHostManager::DidDisownOpener( 451 void RenderFrameHostManager::DidDisownOpener(
450 RenderFrameHost* render_frame_host) { 452 RenderFrameHost* render_frame_host) {
451 // Notify all RenderFrameHosts but the one that notified us. This is necessary 453 // Notify all RenderFrameHosts but the one that notified us. This is necessary
452 // in case a process swap has occurred while the message was in flight. 454 // in case a process swap has occurred while the message was in flight.
453 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 455 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin();
454 iter != proxy_hosts_.end(); 456 iter != proxy_hosts_.end();
455 ++iter) { 457 ++iter) {
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1676 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1675 SiteInstance* instance) { 1677 SiteInstance* instance) {
1676 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1678 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1677 if (iter != proxy_hosts_.end()) { 1679 if (iter != proxy_hosts_.end()) {
1678 delete iter->second; 1680 delete iter->second;
1679 proxy_hosts_.erase(iter); 1681 proxy_hosts_.erase(iter);
1680 } 1682 }
1681 } 1683 }
1682 1684
1683 } // namespace content 1685 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698