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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 23129015: Initialize RenderWidget(Host)(View)s with correct visibility state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 157a17d6a8edae0bbb689d3ff51549b36245b193..9e0a744847c3a06b9cf789a3550ba2e1c5c26b61 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1486,6 +1486,8 @@ void WebContentsImpl::CreateNewWindow(
BrowserPluginGuest::CreateWithOpener(instance_id, new_contents_impl,
GetBrowserPluginGuest(), !!new_contents_impl->opener());
}
+ if (params.disposition == NEW_BACKGROUND_TAB)
+ create_params.initially_hidden = true;
new_contents->Init(create_params);
// Save the window for later if we're not suppressing the opener (since it
@@ -1546,8 +1548,9 @@ void WebContentsImpl::CreateNewWidget(int route_id,
bool is_fullscreen,
WebKit::WebPopupType popup_type) {
RenderProcessHost* process = GetRenderProcessHost();
+ bool hidden = capturer_count_ == 0 && !should_normally_be_visible_;
Charlie Reis 2013/08/20 02:09:58 We should probably call IsHidden instead, in case
RenderWidgetHostImpl* widget_host =
- new RenderWidgetHostImpl(this, process, route_id);
+ new RenderWidgetHostImpl(this, process, route_id, hidden);
created_widgets_.insert(widget_host);
RenderWidgetHostViewPort* widget_view = RenderWidgetHostViewPort::FromRWHV(
@@ -3432,7 +3435,8 @@ WebPreferences WebContentsImpl::GetWebkitPrefs() {
int WebContentsImpl::CreateSwappedOutRenderView(
SiteInstance* instance) {
- return render_manager_.CreateRenderView(instance, MSG_ROUTING_NONE, true);
+ return render_manager_.CreateRenderView(instance, MSG_ROUTING_NONE,
+ true, true);
}
void WebContentsImpl::OnUserGesture() {
@@ -3602,7 +3606,8 @@ int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) {
// Create a swapped out RenderView in the given SiteInstance if none exists,
// setting its opener to the given route_id. Return the new view's route_id.
- return render_manager_.CreateRenderView(instance, opener_route_id, true);
+ return render_manager_.CreateRenderView(instance, opener_route_id,
+ true, true);
}
NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() {
@@ -3682,6 +3687,10 @@ void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
rwh_view->SetSize(GetView()->GetContainerSize());
}
+bool WebContentsImpl::IsHidden() {
+ return capturer_count_ == 0 && !should_normally_be_visible_;
+}
+
RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
}

Powered by Google App Engine
This is Rietveld 408576698