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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1150843002: Dismiss browser plugin modal dialogs when the embedder needs to. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move test file Created 5 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 return GetRenderManager()->current_host(); 664 return GetRenderManager()->current_host();
665 } 665 }
666 666
667 int WebContentsImpl::GetRoutingID() const { 667 int WebContentsImpl::GetRoutingID() const {
668 if (!GetRenderViewHost()) 668 if (!GetRenderViewHost())
669 return MSG_ROUTING_NONE; 669 return MSG_ROUTING_NONE;
670 670
671 return GetRenderViewHost()->GetRoutingID(); 671 return GetRenderViewHost()->GetRoutingID();
672 } 672 }
673 673
674 void WebContentsImpl::CancelActiveAndPendingDialogs() {
675 if (dialog_manager_)
676 dialog_manager_->CancelActiveAndPendingDialogs(this);
677 if (browser_plugin_embedder_)
678 browser_plugin_embedder_->CancelGuestDialogs();
679 }
680
674 int WebContentsImpl::GetFullscreenWidgetRoutingID() const { 681 int WebContentsImpl::GetFullscreenWidgetRoutingID() const {
675 return fullscreen_widget_routing_id_; 682 return fullscreen_widget_routing_id_;
676 } 683 }
677 684
678 void WebContentsImpl::ClosePage() { 685 void WebContentsImpl::ClosePage() {
679 GetRenderViewHost()->ClosePage(); 686 GetRenderViewHost()->ClosePage();
680 } 687 }
681 688
682 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { 689 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const {
683 return GetRenderManager()->GetRenderWidgetHostView(); 690 return GetRenderManager()->GetRenderWidgetHostView();
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 RenderFrameForInterstitialPageCreated(render_frame_host)); 1984 RenderFrameForInterstitialPageCreated(render_frame_host));
1978 } 1985 }
1979 1986
1980 void WebContentsImpl::AttachInterstitialPage( 1987 void WebContentsImpl::AttachInterstitialPage(
1981 InterstitialPageImpl* interstitial_page) { 1988 InterstitialPageImpl* interstitial_page) {
1982 DCHECK(interstitial_page); 1989 DCHECK(interstitial_page);
1983 GetRenderManager()->set_interstitial_page(interstitial_page); 1990 GetRenderManager()->set_interstitial_page(interstitial_page);
1984 1991
1985 // Cancel any visible dialogs so that they don't interfere with the 1992 // Cancel any visible dialogs so that they don't interfere with the
1986 // interstitial. 1993 // interstitial.
1987 if (dialog_manager_) 1994 CancelActiveAndPendingDialogs();
1988 dialog_manager_->CancelActiveAndPendingDialogs(this);
1989 1995
1990 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1996 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1991 DidAttachInterstitialPage()); 1997 DidAttachInterstitialPage());
1992 } 1998 }
1993 1999
1994 void WebContentsImpl::DetachInterstitialPage() { 2000 void WebContentsImpl::DetachInterstitialPage() {
1995 if (ShowingInterstitialPage()) 2001 if (ShowingInterstitialPage())
1996 GetRenderManager()->remove_interstitial_page(); 2002 GetRenderManager()->remove_interstitial_page();
1997 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2003 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1998 DidDetachInterstitialPage()); 2004 DidDetachInterstitialPage());
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 2740
2735 void WebContentsImpl::DidNavigateAnyFramePostCommit( 2741 void WebContentsImpl::DidNavigateAnyFramePostCommit(
2736 RenderFrameHostImpl* render_frame_host, 2742 RenderFrameHostImpl* render_frame_host,
2737 const LoadCommittedDetails& details, 2743 const LoadCommittedDetails& details,
2738 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 2744 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
2739 // Now that something has committed, we don't need to track whether the 2745 // Now that something has committed, we don't need to track whether the
2740 // initial page has been accessed. 2746 // initial page has been accessed.
2741 has_accessed_initial_document_ = false; 2747 has_accessed_initial_document_ = false;
2742 2748
2743 // If we navigate off the page, close all JavaScript dialogs. 2749 // If we navigate off the page, close all JavaScript dialogs.
2744 if (dialog_manager_ && !details.is_in_page) 2750 if (!details.is_in_page)
2745 dialog_manager_->CancelActiveAndPendingDialogs(this); 2751 CancelActiveAndPendingDialogs();
2746 2752
2747 // Notify observers about navigation. 2753 // Notify observers about navigation.
2748 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2754 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2749 DidNavigateAnyFrame(render_frame_host, details, params)); 2755 DidNavigateAnyFrame(render_frame_host, details, params));
2750 } 2756 }
2751 2757
2752 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { 2758 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
2753 contents_mime_type_ = mime_type; 2759 contents_mime_type_ = mime_type;
2754 } 2760 }
2755 2761
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
3586 // The pending page's RenderViewHost is gone. 3592 // The pending page's RenderViewHost is gone.
3587 return; 3593 return;
3588 } 3594 }
3589 3595
3590 // Ensure fullscreen mode is exited in the |delegate_| since a crashed 3596 // Ensure fullscreen mode is exited in the |delegate_| since a crashed
3591 // renderer may not have made a clean exit. 3597 // renderer may not have made a clean exit.
3592 if (IsFullscreenForCurrentTab()) 3598 if (IsFullscreenForCurrentTab())
3593 ExitFullscreenMode(); 3599 ExitFullscreenMode();
3594 3600
3595 // Cancel any visible dialogs so they are not left dangling over the sad tab. 3601 // Cancel any visible dialogs so they are not left dangling over the sad tab.
3596 if (dialog_manager_) 3602 CancelActiveAndPendingDialogs();
3597 dialog_manager_->CancelActiveAndPendingDialogs(this);
3598 3603
3599 if (delegate_) 3604 if (delegate_)
3600 delegate_->HideValidationMessage(this); 3605 delegate_->HideValidationMessage(this);
3601 3606
3602 SetIsLoading(false, true, nullptr); 3607 SetIsLoading(false, true, nullptr);
3603 NotifyDisconnected(); 3608 NotifyDisconnected();
3604 SetIsCrashed(status, error_code); 3609 SetIsCrashed(status, error_code);
3605 3610
3606 // Reset the loading progress. TODO(avi): What does it mean to have a 3611 // Reset the loading progress. TODO(avi): What does it mean to have a
3607 // "renderer crash" when there is more than one renderer process serving a 3612 // "renderer crash" when there is more than one renderer process serving a
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 // normal size later so just ignore it. 4041 // normal size later so just ignore it.
4037 if (!size.IsEmpty()) 4042 if (!size.IsEmpty())
4038 view_->SizeContents(size); 4043 view_->SizeContents(size);
4039 } 4044 }
4040 4045
4041 void WebContentsImpl::CancelModalDialogsForRenderManager() { 4046 void WebContentsImpl::CancelModalDialogsForRenderManager() {
4042 // We need to cancel modal dialogs when doing a process swap, since the load 4047 // We need to cancel modal dialogs when doing a process swap, since the load
4043 // deferrer would prevent us from swapping out. We also clear the state 4048 // deferrer would prevent us from swapping out. We also clear the state
4044 // because this is a cross-process navigation, which means that it's a new 4049 // because this is a cross-process navigation, which means that it's a new
4045 // site that should not have to pay for the sins of its predecessor. 4050 // site that should not have to pay for the sins of its predecessor.
4051 //
4052 // Note that we don't bother telling browser_plugin_embedder_ because the
4053 // cross-process navigation will either destroy the browser plugins or not
4054 // require their dialogs to close.
4046 if (dialog_manager_) 4055 if (dialog_manager_)
4047 dialog_manager_->ResetDialogState(this); 4056 dialog_manager_->ResetDialogState(this);
4048 } 4057 }
4049 4058
4050 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, 4059 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host,
4051 RenderFrameHost* new_host, 4060 RenderFrameHost* new_host,
4052 bool is_main_frame) { 4061 bool is_main_frame) {
4053 if (is_main_frame) { 4062 if (is_main_frame) {
4054 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, 4063 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr,
4055 new_host->GetRenderViewHost()); 4064 new_host->GetRenderViewHost());
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
4388 player_map->erase(it); 4397 player_map->erase(it);
4389 } 4398 }
4390 4399
4391 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4400 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4392 force_disable_overscroll_content_ = force_disable; 4401 force_disable_overscroll_content_ = force_disable;
4393 if (view_) 4402 if (view_)
4394 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4403 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4395 } 4404 }
4396 4405
4397 } // namespace content 4406 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698