| OLD | NEW |
| 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 Loading... |
| 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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 RenderFrameForInterstitialPageCreated(render_frame_host)); | 1989 RenderFrameForInterstitialPageCreated(render_frame_host)); |
| 1983 } | 1990 } |
| 1984 | 1991 |
| 1985 void WebContentsImpl::AttachInterstitialPage( | 1992 void WebContentsImpl::AttachInterstitialPage( |
| 1986 InterstitialPageImpl* interstitial_page) { | 1993 InterstitialPageImpl* interstitial_page) { |
| 1987 DCHECK(interstitial_page); | 1994 DCHECK(interstitial_page); |
| 1988 GetRenderManager()->set_interstitial_page(interstitial_page); | 1995 GetRenderManager()->set_interstitial_page(interstitial_page); |
| 1989 | 1996 |
| 1990 // Cancel any visible dialogs so that they don't interfere with the | 1997 // Cancel any visible dialogs so that they don't interfere with the |
| 1991 // interstitial. | 1998 // interstitial. |
| 1992 if (dialog_manager_) | 1999 CancelActiveAndPendingDialogs(); |
| 1993 dialog_manager_->CancelActiveAndPendingDialogs(this); | |
| 1994 | 2000 |
| 1995 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2001 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1996 DidAttachInterstitialPage()); | 2002 DidAttachInterstitialPage()); |
| 1997 } | 2003 } |
| 1998 | 2004 |
| 1999 void WebContentsImpl::DetachInterstitialPage() { | 2005 void WebContentsImpl::DetachInterstitialPage() { |
| 2000 if (ShowingInterstitialPage()) | 2006 if (ShowingInterstitialPage()) |
| 2001 GetRenderManager()->remove_interstitial_page(); | 2007 GetRenderManager()->remove_interstitial_page(); |
| 2002 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2008 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2003 DidDetachInterstitialPage()); | 2009 DidDetachInterstitialPage()); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2748 | 2754 |
| 2749 void WebContentsImpl::DidNavigateAnyFramePostCommit( | 2755 void WebContentsImpl::DidNavigateAnyFramePostCommit( |
| 2750 RenderFrameHostImpl* render_frame_host, | 2756 RenderFrameHostImpl* render_frame_host, |
| 2751 const LoadCommittedDetails& details, | 2757 const LoadCommittedDetails& details, |
| 2752 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 2758 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 2753 // Now that something has committed, we don't need to track whether the | 2759 // Now that something has committed, we don't need to track whether the |
| 2754 // initial page has been accessed. | 2760 // initial page has been accessed. |
| 2755 has_accessed_initial_document_ = false; | 2761 has_accessed_initial_document_ = false; |
| 2756 | 2762 |
| 2757 // If we navigate off the page, close all JavaScript dialogs. | 2763 // If we navigate off the page, close all JavaScript dialogs. |
| 2758 if (dialog_manager_ && !details.is_in_page) | 2764 if (!details.is_in_page) |
| 2759 dialog_manager_->CancelActiveAndPendingDialogs(this); | 2765 CancelActiveAndPendingDialogs(); |
| 2760 | 2766 |
| 2761 // Notify observers about navigation. | 2767 // Notify observers about navigation. |
| 2762 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2768 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2763 DidNavigateAnyFrame(render_frame_host, details, params)); | 2769 DidNavigateAnyFrame(render_frame_host, details, params)); |
| 2764 } | 2770 } |
| 2765 | 2771 |
| 2766 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { | 2772 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { |
| 2767 contents_mime_type_ = mime_type; | 2773 contents_mime_type_ = mime_type; |
| 2768 } | 2774 } |
| 2769 | 2775 |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3600 // The pending page's RenderViewHost is gone. | 3606 // The pending page's RenderViewHost is gone. |
| 3601 return; | 3607 return; |
| 3602 } | 3608 } |
| 3603 | 3609 |
| 3604 // Ensure fullscreen mode is exited in the |delegate_| since a crashed | 3610 // Ensure fullscreen mode is exited in the |delegate_| since a crashed |
| 3605 // renderer may not have made a clean exit. | 3611 // renderer may not have made a clean exit. |
| 3606 if (IsFullscreenForCurrentTab()) | 3612 if (IsFullscreenForCurrentTab()) |
| 3607 ExitFullscreenMode(); | 3613 ExitFullscreenMode(); |
| 3608 | 3614 |
| 3609 // Cancel any visible dialogs so they are not left dangling over the sad tab. | 3615 // Cancel any visible dialogs so they are not left dangling over the sad tab. |
| 3610 if (dialog_manager_) | 3616 CancelActiveAndPendingDialogs(); |
| 3611 dialog_manager_->CancelActiveAndPendingDialogs(this); | |
| 3612 | 3617 |
| 3613 if (delegate_) | 3618 if (delegate_) |
| 3614 delegate_->HideValidationMessage(this); | 3619 delegate_->HideValidationMessage(this); |
| 3615 | 3620 |
| 3616 SetIsLoading(false, true, nullptr); | 3621 SetIsLoading(false, true, nullptr); |
| 3617 NotifyDisconnected(); | 3622 NotifyDisconnected(); |
| 3618 SetIsCrashed(status, error_code); | 3623 SetIsCrashed(status, error_code); |
| 3619 | 3624 |
| 3620 // Reset the loading progress. TODO(avi): What does it mean to have a | 3625 // Reset the loading progress. TODO(avi): What does it mean to have a |
| 3621 // "renderer crash" when there is more than one renderer process serving a | 3626 // "renderer crash" when there is more than one renderer process serving a |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4066 // normal size later so just ignore it. | 4071 // normal size later so just ignore it. |
| 4067 if (!size.IsEmpty()) | 4072 if (!size.IsEmpty()) |
| 4068 view_->SizeContents(size); | 4073 view_->SizeContents(size); |
| 4069 } | 4074 } |
| 4070 | 4075 |
| 4071 void WebContentsImpl::CancelModalDialogsForRenderManager() { | 4076 void WebContentsImpl::CancelModalDialogsForRenderManager() { |
| 4072 // We need to cancel modal dialogs when doing a process swap, since the load | 4077 // We need to cancel modal dialogs when doing a process swap, since the load |
| 4073 // deferrer would prevent us from swapping out. We also clear the state | 4078 // deferrer would prevent us from swapping out. We also clear the state |
| 4074 // because this is a cross-process navigation, which means that it's a new | 4079 // because this is a cross-process navigation, which means that it's a new |
| 4075 // site that should not have to pay for the sins of its predecessor. | 4080 // site that should not have to pay for the sins of its predecessor. |
| 4081 // |
| 4082 // Note that we don't bother telling browser_plugin_embedder_ because the |
| 4083 // cross-process navigation will either destroy the browser plugins or not |
| 4084 // require their dialogs to close. |
| 4076 if (dialog_manager_) | 4085 if (dialog_manager_) |
| 4077 dialog_manager_->ResetDialogState(this); | 4086 dialog_manager_->ResetDialogState(this); |
| 4078 } | 4087 } |
| 4079 | 4088 |
| 4080 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, | 4089 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, |
| 4081 RenderFrameHost* new_host, | 4090 RenderFrameHost* new_host, |
| 4082 bool is_main_frame) { | 4091 bool is_main_frame) { |
| 4083 if (is_main_frame) { | 4092 if (is_main_frame) { |
| 4084 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, | 4093 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, |
| 4085 new_host->GetRenderViewHost()); | 4094 new_host->GetRenderViewHost()); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4423 node->render_manager()->ResumeResponseDeferredAtStart(); | 4432 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4424 } | 4433 } |
| 4425 | 4434 |
| 4426 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4435 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4427 force_disable_overscroll_content_ = force_disable; | 4436 force_disable_overscroll_content_ = force_disable; |
| 4428 if (view_) | 4437 if (view_) |
| 4429 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4438 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4430 } | 4439 } |
| 4431 | 4440 |
| 4432 } // namespace content | 4441 } // namespace content |
| OLD | NEW |