notify_disconnection_(false),
dialog_manager_(NULL),
is_showing_before_unload_dialog_(false),
+ last_active_time_(base::TimeTicks::Now()),
closed_by_user_gesture_(false),
minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)),
maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)),
if (observer->OnMessageReceived(message))
return true;
- // Message handlers should be aware of which RenderViewHost sent the
- // message, which is temporarily stored in render_view_message_source_.
- render_view_message_source_ = render_view_host;
+ // Message handlers should be aware of which
+ // RenderViewHost/RenderFrameHost sent the message, which is temporarily
+ // stored in render_(view|frame)_message_source_.
+ if (render_frame_host)
+ render_frame_message_source_ = render_frame_host;
+ else
+ render_view_message_source_ = render_view_host;
+
bool handled = true;
bool message_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok)
OnDidDisplayInsecureContent)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent,
OnDidRunInsecureContent)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame,
+ IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad,
OnDocumentLoadedInFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError,
- OnDidFailLoadWithError)
IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits)
IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory)
IPC_MESSAGE_HANDLER_DELAY_REPLY(JavaBridgeHostMsg_GetChannelHandle,
OnJavaBridgeGetChannelHandle)
#endif
- IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_MediaPlayingNotification,
+ OnMediaPlayingNotification)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_MediaPausedNotification,
+ OnMediaPausedNotification)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint,
OnFirstVisuallyNonEmptyPaint)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
render_view_message_source_ = NULL;
+ render_frame_message_source_ = NULL;
if (!message_is_ok) {
RecordAction(base::UserMetricsAction("BadMessageTerminate_RVD"));
return displayed_insecure_content_;
}
-void WebContentsImpl::IncrementCapturerCount() {
+void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) {
DCHECK(!is_being_destroyed_);
++capturer_count_;
DVLOG(1) << "There are now " << capturer_count_
<< " capturing(s) of WebContentsImpl@" << this;
+
+ // Note: This provides a hint to upstream code to size the views optimally
+ // for quality (e.g., to avoid scaling).
+ if (!capture_size.IsEmpty() && preferred_size_for_capture_.IsEmpty()) {
+ preferred_size_for_capture_ = capture_size;
+ OnPreferredSizeChanged(preferred_size_);
+ }
}
void WebContentsImpl::DecrementCapturerCount() {
if (is_being_destroyed_)
return;
+ if (capturer_count_ == 0) {
+ const gfx::Size old_size = preferred_size_for_capture_;
+ preferred_size_for_capture_ = gfx::Size();
+ OnPreferredSizeChanged(old_size);
+ }
+
if (IsHidden()) {
DVLOG(1) << "Executing delayed WasHidden().";
WasHidden();
delegate_->NavigationStateChanged(this, changed_flags);
}
-base::TimeTicks WebContentsImpl::GetLastSelectedTime() const {
- return last_selected_time_;
+base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
+ return last_active_time_;
}
void WebContentsImpl::WasShown() {
#endif
}
- last_selected_time_ = base::TimeTicks::Now();
+ last_active_time_ = base::TimeTicks::Now();
// The resize rect might have changed while this was inactive -- send the new
// one to make sure it's up to date.
return false;
}
+bool WebContentsImpl::PreHandleGestureEvent(
+ const blink::WebGestureEvent& event) {
+ return delegate_ && delegate_->PreHandleGestureEvent(this, event);
+}
+
#if defined(OS_WIN)
gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() {
return accessible_parent_;
return widget_host_view;
}
-void WebContentsImpl::ShowContextMenu(const ContextMenuParams& params) {
- // Allow WebContentsDelegates to handle the context menu operation first.
- if (delegate_ && delegate_->HandleContextMenu(params))
- return;
-
- render_view_host_delegate_view_->ShowContextMenu(params);
-}
-
void WebContentsImpl::RequestMediaAccessPermission(
const MediaStreamRequest& request,
const MediaResponseCallback& callback) {
}
void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) {
+ const gfx::Size old_size = GetPreferredSize();
preferred_size_ = pref_size;
- if (delegate_)
- delegate_->UpdatePreferredSize(this, pref_size);
+ OnPreferredSizeChanged(old_size);
}
void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) {
}
gfx::Size WebContentsImpl::GetPreferredSize() const {
- return preferred_size_;
+ return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_;
}
bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
render_frame_host->render_view_host()));
}
+void WebContentsImpl::DidFailLoadWithError(
+ RenderFrameHostImpl* render_frame_host,
+ int64 frame_id,
+ const GURL& url,
+ bool is_main_frame,
+ int error_code,
+ const base::string16& error_description) {
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ DidFailLoad(frame_id, url, is_main_frame,
+ error_code, error_description,
+ render_frame_host->render_view_host()));
+}
+
void WebContentsImpl::NotifyChangedNavigationState(
InvalidateTypes changed_flags) {
NotifyNavigationStateChanged(changed_flags);
render_frame_host));
}
+void WebContentsImpl::DidCommitProvisionalLoad(
+ int64 frame_id,
+ const base::string16& frame_unique_name,
+ bool is_main_frame,
+ const GURL& url,
+ PageTransition transition_type,
+ RenderFrameHostImpl* render_frame_host) {
+ RenderViewHost* render_view_host = render_frame_host->render_view_host();
+ // Notify observers about the commit of the provisional load.
+ FOR_EACH_OBSERVER(
+ WebContentsObserver,
+ observers_,
+ DidCommitProvisionalLoadForFrame(frame_id,
+ frame_unique_name,
+ is_main_frame,
+ url,
+ transition_type,
+ render_view_host));
+}
+
+void WebContentsImpl::DidNavigateMainFramePostCommit(
+ const LoadCommittedDetails& details,
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ if (details.is_navigation_to_different_page()) {
+ // Clear the status bubble. This is a workaround for a bug where WebKit
+ // doesn't let us know that the cursor left an element during a
+ // transition (this is also why the mouse cursor remains as a hand after
+ // clicking on a link); see bugs 1184641 and 980803. We don't want to
+ // clear the bubble when a user navigates to a named anchor in the same
+ // page.
+ UpdateTargetURL(details.entry->GetPageID(), GURL());
+ }
+
+ if (!details.is_in_page) {
+ // Once the main frame is navigated, we're no longer considered to have
+ // displayed insecure content.
+ displayed_insecure_content_ = false;
+ SSLManager::NotifySSLInternalStateChanged(
+ GetController().GetBrowserContext());
+ }
+
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ DidNavigateMainFrame(details, params));
+
+ if (delegate_) {
+ delegate_->DidNavigateMainFramePostCommit(this);
+ view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
+ }
+}
+
+void WebContentsImpl::DidNavigateAnyFramePostCommit(
+ RenderFrameHostImpl* render_frame_host,
+ const LoadCommittedDetails& details,
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ // If we navigate off the page, close all JavaScript dialogs.
+ if (dialog_manager_ && !details.is_in_page)
+ dialog_manager_->CancelActiveAndPendingDialogs(this);
+
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ DidNavigateAnyFrame(details, params));
+}
+
+void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
+ contents_mime_type_ = mime_type;
+}
+
+bool WebContentsImpl::CanOverscrollContent() {
+ if (delegate_)
+ return delegate_->CanOverscrollContent();
+
+ return false;
+}
+
void WebContentsImpl::OnDidLoadResourceFromMemoryCache(
const GURL& url,
const std::string& security_info,
}
void WebContentsImpl::OnDocumentLoadedInFrame(int64 frame_id) {
- FOR_EACH_OBSERVER(
- WebContentsObserver, observers_,
- DocumentLoadedInFrame(frame_id, render_view_message_source_));
+ CHECK(render_frame_message_source_);
+ CHECK(!render_view_message_source_);
+ RenderFrameHostImpl* rfh =
+ static_cast<RenderFrameHostImpl*>(render_frame_message_source_);
+
+ FOR_EACH_OBSERVER(WebContentsObserver,
+ observers_,
+ DocumentLoadedInFrame(frame_id, rfh->render_view_host()));
}
void WebContentsImpl::OnDidFinishLoad(
render_view_message_source_));
}
-void WebContentsImpl::OnDidFailLoadWithError(
- int64 frame_id,
- const GURL& url,
- bool is_main_frame,
- int error_code,
- const base::string16& error_description) {
- if (!render_view_message_source_) {
- RecordAction(base::UserMetricsAction("BadMessageTerminate_RVD3"));
- GetRenderProcessHost()->ReceivedBadMessage();
- return;
- }
- GURL validated_url(url);
- RenderProcessHost* render_process_host =
- render_view_message_source_->GetProcess();
- render_process_host->FilterURL(false, &validated_url);
- FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- DidFailLoad(frame_id, validated_url, is_main_frame,
- error_code, error_description,
- render_view_message_source_));
-}
-
void WebContentsImpl::OnGoToEntryAtOffset(int offset) {
if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) {
NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
DidUpdateFaviconURL(page_id, candidates));
}
-void WebContentsImpl::OnMediaNotification(int64 player_cookie,
- bool has_video,
- bool has_audio,
- bool is_playing) {
- // Chrome OS does its own detection of audio and video.
+void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie,
+ bool has_video,
+ bool has_audio) {
+// Chrome OS does its own detection of audio and video.
#if !defined(OS_CHROMEOS)
- if (is_playing) {
- scoped_ptr<PowerSaveBlocker> blocker;
- if (has_video) {
- blocker = PowerSaveBlocker::Create(
- PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
- "Playing video");
+ scoped_ptr<PowerSaveBlocker> blocker;
+ if (has_video) {
+ blocker = PowerSaveBlocker::Create(
+ PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, "Playing video");
#if defined(OS_ANDROID)
- static_cast<PowerSaveBlockerImpl*>(blocker.get())->
- InitDisplaySleepBlocker(GetView()->GetNativeView());
+ static_cast<PowerSaveBlockerImpl*>(blocker.get())
+ ->InitDisplaySleepBlocker(GetView()->GetNativeView());
#endif
- } else if (has_audio) {
- blocker = PowerSaveBlocker::Create(
- PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
- "Playing audio");
- }
+ } else if (has_audio) {
+ blocker = PowerSaveBlocker::Create(
+ PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, "Playing audio");
+ }
- if (blocker) {
- power_save_blockers_[render_view_message_source_][player_cookie] =
- blocker.release();
- }
- } else {
- delete power_save_blockers_[render_view_message_source_][player_cookie];
- power_save_blockers_[render_view_message_source_].erase(player_cookie);
+ if (blocker) {
+ power_save_blockers_[render_view_message_source_][player_cookie] =
+ blocker.release();
}
#endif // !defined(OS_CHROMEOS)
}
+void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) {
+ // Chrome OS does its own detection of audio and video.
+#if !defined(OS_CHROMEOS)
+ delete power_save_blockers_[render_view_message_source_][player_cookie];
+ power_save_blockers_[render_view_message_source_].erase(player_cookie);
+#endif // !defined(OS_CHROMEOS)
+}
+
void WebContentsImpl::OnFirstVisuallyNonEmptyPaint(int32 page_id) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidFirstVisuallyNonEmptyPaint(page_id));
type, Source<NavigationController>(&controller_), det);
}
-void WebContentsImpl::DidNavigateMainFramePostCommit(
- const LoadCommittedDetails& details,
- const ViewHostMsg_FrameNavigate_Params& params) {
- if (details.is_navigation_to_different_page()) {
- // Clear the status bubble. This is a workaround for a bug where WebKit
- // doesn't let us know that the cursor left an element during a
- // transition (this is also why the mouse cursor remains as a hand after
- // clicking on a link); see bugs 1184641 and 980803. We don't want to
- // clear the bubble when a user navigates to a named anchor in the same
- // page.
- UpdateTargetURL(details.entry->GetPageID(), GURL());
- }
-
- if (!details.is_in_page) {
- // Once the main frame is navigated, we're no longer considered to have
- // displayed insecure content.
- displayed_insecure_content_ = false;
- SSLManager::NotifySSLInternalStateChanged(
- GetController().GetBrowserContext());
- }
-
- // Notify observers about navigation.
- FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- DidNavigateMainFrame(details, params));
-}
-
-void WebContentsImpl::DidNavigateAnyFramePostCommit(
- RenderViewHost* render_view_host,
- const LoadCommittedDetails& details,
- const ViewHostMsg_FrameNavigate_Params& params) {
- // If we navigate off the page, close all JavaScript dialogs.
- if (dialog_manager_ && !details.is_in_page)
- dialog_manager_->CancelActiveAndPendingDialogs(this);
-
- // Notify observers about navigation.
- FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- DidNavigateAnyFrame(details, params));
-}
-
-bool WebContentsImpl::ShouldAssignSiteForURL(const GURL& url) {
- // about:blank should not "use up" a new SiteInstance. The SiteInstance can
- // still be used for a normal web site.
- if (url == GURL(kAboutBlankURL))
- return false;
-
- // The embedder will then have the opportunity to determine if the URL
- // should "use up" the SiteInstance.
- return GetContentClient()->browser()->ShouldAssignSiteForURL(url);
-}
-
void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
// If we are creating a RVH for a restored controller, then we need to make
// sure the RenderView starts with a next_page_id_ larger than the number
RenderFrameDeleted(render_frame_host));
}
-void WebContentsImpl::WorkerCrashed() {
+void WebContentsImpl::WorkerCrashed(RenderFrameHost* render_frame_host) {
if (delegate_)
delegate_->WorkerCrashed(this);
}
+void WebContentsImpl::ShowContextMenu(RenderFrameHost* render_frame_host,
+ const ContextMenuParams& params) {
+ // Allow WebContentsDelegates to handle the context menu operation first.
+ if (delegate_ && delegate_->HandleContextMenu(params))
+ return;
+
+ render_view_host_delegate_view_->ShowContextMenu(render_frame_host, params);
+}
+
WebContents* WebContentsImpl::GetAsWebContents() {
return this;
}
// Don't send notifications if we are just creating a swapped-out RVH for
// the opener chain. These won't be used for view-source or WebUI, so it's
// ok to return early.
- if (static_cast<RenderViewHostImpl*>(render_view_host)->is_swapped_out())
+ if (static_cast<RenderViewHostImpl*>(render_view_host)->IsSwappedOut())
return;
if (delegate_)
// We tell the observers now instead of when the main RenderFrameHostImpl is
// constructed because otherwise it would be too early (i.e. IPCs sent to the
// frame would be dropped because it's not created yet).
- RenderFrameHost* main_frame = GetMainFrame();
+ RenderFrameHost* main_frame = render_view_host->GetMainFrame();
FOR_EACH_OBSERVER(
WebContentsObserver, observers_, RenderFrameCreated(main_frame));
}
return;
}
+ // Cancel any visible dialogs so they are not left dangling over the sad tab.
+ if (dialog_manager_)
+ dialog_manager_->CancelActiveAndPendingDialogs(this);
+
ClearPowerSaveBlockers(rvh);
SetIsLoading(rvh, false, NULL);
NotifyDisconnected();
FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh));
}
-void WebContentsImpl::DidNavigate(
- RenderViewHost* rvh,
- const ViewHostMsg_FrameNavigate_Params& orig_params) {
- ViewHostMsg_FrameNavigate_Params params(orig_params);
- bool use_site_per_process =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess);
- if (frame_tree_.IsFirstNavigationAfterSwap()) {
- // First navigation should be a main frame navigation.
- // TODO(creis): This DCHECK is currently disabled for --site-per-process
- // because cross-process subframe navigations still have a main frame
- // PageTransition.
- if (!use_site_per_process)
- DCHECK(PageTransitionIsMainFrame(params.transition));
- frame_tree_.OnFirstNavigationAfterSwap(params.frame_id);
- }
-
- // When using --site-per-process, look up the FrameTreeNode ID that the
- // renderer-specific frame ID corresponds to.
- int64 frame_tree_node_id = frame_tree_.root()->frame_tree_node_id();
- if (use_site_per_process) {
- FrameTreeNode* source_node = frame_tree_.FindByFrameID(params.frame_id);
- if (source_node)
- frame_tree_node_id = source_node->frame_tree_node_id();
-
- // TODO(creis): In the short term, cross-process subframe navigations are
- // happening in the pending RenderViewHost's top-level frame. (We need to
- // both mirror the frame tree and get the navigation to occur in the correct
- // subframe to fix this.) Until then, we should check whether we have a
- // pending NavigationEntry with a frame ID and if so, treat the
- // cross-process "main frame" navigation as a subframe navigation. This
- // limits us to a single cross-process subframe per RVH, and it affects
- // NavigateToEntry, NavigatorImpl::DidStartProvisionalLoad, and
- // OnDidFinishLoad.
- NavigationEntryImpl* pending_entry =
- NavigationEntryImpl::FromNavigationEntry(controller_.GetPendingEntry());
- int root_ftn_id = frame_tree_.root()->frame_tree_node_id();
- if (pending_entry &&
- pending_entry->frame_tree_node_id() != -1 &&
- pending_entry->frame_tree_node_id() != root_ftn_id) {
- params.transition = PAGE_TRANSITION_AUTO_SUBFRAME;
- frame_tree_node_id = pending_entry->frame_tree_node_id();
- }
- }
-
- if (PageTransitionIsMainFrame(params.transition)) {
- // When overscroll navigation gesture is enabled, a screenshot of the page
- // in its current state is taken so that it can be used during the
- // nav-gesture. It is necessary to take the screenshot here, before calling
- // RenderFrameHostManager::DidNavigateMainFrame, because that can change
- // WebContents::GetRenderViewHost to return the new host, instead of the one
- // that may have just been swapped out.
- if (delegate_ && delegate_->CanOverscrollContent())
- controller_.TakeScreenshot();
-
- if (!use_site_per_process)
- GetRenderManager()->DidNavigateMainFrame(rvh);
- }
-
- // When using --site-per-process, we notify the RFHM for all navigations,
- // not just main frame navigations.
- if (use_site_per_process) {
- FrameTreeNode* frame = frame_tree_.FindByID(frame_tree_node_id);
- // TODO(creis): Rename to DidNavigateFrame.
- frame->render_manager()->DidNavigateMainFrame(rvh);
- }
-
- // Update the site of the SiteInstance if it doesn't have one yet, unless
- // assigning a site is not necessary for this URL. In that case, the
- // SiteInstance can still be considered unused until a navigation to a real
- // page.
- if (!static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() &&
- ShouldAssignSiteForURL(params.url)) {
- static_cast<SiteInstanceImpl*>(GetSiteInstance())->SetSite(params.url);
- }
-
- // Need to update MIME type here because it's referred to in
- // UpdateNavigationCommands() called by RendererDidNavigate() to
- // determine whether or not to enable the encoding menu.
- // It's updated only for the main frame. For a subframe,
- // RenderView::UpdateURL does not set params.contents_mime_type.
- // (see http://code.google.com/p/chromium/issues/detail?id=2929 )
- // TODO(jungshik): Add a test for the encoding menu to avoid
- // regressing it again.
- if (PageTransitionIsMainFrame(params.transition))
- contents_mime_type_ = params.contents_mime_type;
-
- LoadCommittedDetails details;
- bool did_navigate = controller_.RendererDidNavigate(rvh, params, &details);
-
- // For now, keep track of each frame's URL in its FrameTreeNode. This lets
- // us estimate our process count for implementing OOP iframes.
- // TODO(creis): Remove this when we track which pages commit in each frame.
- frame_tree_.SetFrameUrl(params.frame_id, params.url);
-
- // Send notification about committed provisional loads. This notification is
- // different from the NAV_ENTRY_COMMITTED notification which doesn't include
- // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
- if (details.type != NAVIGATION_TYPE_NAV_IGNORE) {
- // For AUTO_SUBFRAME navigations, an event for the main frame is generated
- // that is not recorded in the navigation history. For the purpose of
- // tracking navigation events, we treat this event as a sub frame navigation
- // event.
- bool is_main_frame = did_navigate ? details.is_main_frame : false;
- PageTransition transition_type = params.transition;
- // Whether or not a page transition was triggered by going backward or
- // forward in the history is only stored in the navigation controller's
- // entry list.
- if (did_navigate &&
- (controller_.GetLastCommittedEntry()->GetTransitionType() &
- PAGE_TRANSITION_FORWARD_BACK)) {
- transition_type = PageTransitionFromInt(
- params.transition | PAGE_TRANSITION_FORWARD_BACK);
- }
- // Notify observers about the commit of the provisional load.
- FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- DidCommitProvisionalLoadForFrame(
- params.frame_id,
- params.frame_unique_name,
- is_main_frame,
- params.url,
- transition_type,
- rvh));
- }
-
- if (!did_navigate)
- return; // No navigation happened.
-
- // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen
- // for the appropriate notification (best) or you can add it to
- // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if
- // necessary, please).
-
- // Run post-commit tasks.
- if (details.is_main_frame) {
- DidNavigateMainFramePostCommit(details, params);
- if (delegate_) {
- delegate_->DidNavigateMainFramePostCommit(this);
- view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
- }
- }
- DidNavigateAnyFramePostCommit(rvh, details, params);
-}
-
void WebContentsImpl::UpdateState(RenderViewHost* rvh,
int32 page_id,
const PageState& page_state) {
delegate_->MoveContents(this, new_bounds);
}
-void WebContentsImpl::DidStartLoading(RenderViewHost* render_view_host) {
- SetIsLoading(render_view_host, true, NULL);
+void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host) {
+ SetIsLoading(render_frame_host->GetRenderViewHost(), true, NULL);
}
-void WebContentsImpl::DidStopLoading(RenderViewHost* render_view_host) {
+void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) {
scoped_ptr<LoadNotificationDetails> details;
// Use the last committed entry rather than the active one, in case a
controller_.GetCurrentEntryIndex()));
}
- SetIsLoading(render_view_host, false, details.get());
+ SetIsLoading(render_frame_host->GetRenderViewHost(), false, details.get());
}
void WebContentsImpl::DidCancelLoading() {
bool user_gesture) {
// If this came from a swapped out RenderViewHost, we only allow the request
// if we are still in the same BrowsingInstance.
- if (static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() &&
+ if (static_cast<RenderViewHostImpl*>(rvh)->IsSwappedOut() &&
!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) {
return;
}
// showing an interstitial as it's shown over the previous page and we don't
// want the hidden page's dialogs to interfere with the interstitial.
bool suppress_this_message =
- static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out() ||
+ static_cast<RenderViewHostImpl*>(rvh)->IsSwappedOut() ||
ShowingInterstitialPage() ||
!delegate_ ||
delegate_->ShouldSuppressDialogs() ||
delegate_->WillRunBeforeUnloadConfirm();
bool suppress_this_message =
- rvhi->is_swapped_out() ||
+ rvhi->rvh_state() != RenderViewHostImpl::STATE_DEFAULT ||
!delegate_ ||
delegate_->ShouldSuppressDialogs() ||
!delegate_->GetJavaScriptDialogManager();
if (is_showing_before_unload_dialog_ && !success) {
// If a beforeunload dialog is canceled, we need to stop the throbber from
// spinning, since we forced it to start spinning in Navigate.
- DidStopLoading(rvh);
+ DidStopLoading(rvh->GetMainFrame());
controller_.DiscardNonCommittedEntries();
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
FrameDetached(render_view_host, frame_id));
}
+void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
+ if (!delegate_)
+ return;
+ const gfx::Size new_size = GetPreferredSize();
+ if (new_size != old_size)
+ delegate_->UpdatePreferredSize(this, new_size);
+}
+
} // namespace content