OLD | NEW |
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 Loading... |
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_caused_by_user_gesture) { |
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_) { |
439 // A navigation in the original page has taken place. Cancel the pending | 440 if (was_caused_by_user_gesture) { |
440 // one. | 441 // A navigation in the original page has taken place. Cancel the pending |
441 CancelPending(); | 442 // one. Only do it for user gesture originated navigations to prevent |
442 cross_navigation_pending_ = false; | 443 // page doing any shenanigans to prevent user from navigating. |
| 444 // See https://code.google.com/p/chromium/issues/detail?id=75195 |
| 445 CancelPending(); |
| 446 cross_navigation_pending_ = false; |
| 447 } |
443 } else { | 448 } else { |
444 // No one else should be sending us DidNavigate in this state. | 449 // No one else should be sending us DidNavigate in this state. |
445 DCHECK(false); | 450 DCHECK(false); |
446 } | 451 } |
447 } | 452 } |
448 | 453 |
449 void RenderFrameHostManager::DidDisownOpener( | 454 void RenderFrameHostManager::DidDisownOpener( |
450 RenderFrameHost* render_frame_host) { | 455 RenderFrameHost* render_frame_host) { |
451 // Notify all RenderFrameHosts but the one that notified us. This is necessary | 456 // 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. | 457 // in case a process swap has occurred while the message was in flight. |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1679 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1675 SiteInstance* instance) { | 1680 SiteInstance* instance) { |
1676 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1681 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1677 if (iter != proxy_hosts_.end()) { | 1682 if (iter != proxy_hosts_.end()) { |
1678 delete iter->second; | 1683 delete iter->second; |
1679 proxy_hosts_.erase(iter); | 1684 proxy_hosts_.erase(iter); |
1680 } | 1685 } |
1681 } | 1686 } |
1682 | 1687 |
1683 } // namespace content | 1688 } // namespace content |
OLD | NEW |