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

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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bb32c32a1301619a2da7a8f7cf9b553caf6e16b4 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1049,9 +1049,7 @@ void WebContentsImpl::DecrementCapturerCount() {
if (is_being_destroyed_)
return;
- // While capturer_count_ was greater than zero, the WasHidden() calls to RWHV
- // were being prevented. If there are no more capturers, make the call now.
- if (capturer_count_ == 0 && !should_normally_be_visible_) {
+ if (IsHidden()) {
DVLOG(1) << "Executing delayed WasHidden().";
WasHidden();
}
@@ -1486,6 +1484,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
@@ -1547,7 +1547,7 @@ void WebContentsImpl::CreateNewWidget(int route_id,
WebKit::WebPopupType popup_type) {
RenderProcessHost* process = GetRenderProcessHost();
RenderWidgetHostImpl* widget_host =
- new RenderWidgetHostImpl(this, process, route_id);
+ new RenderWidgetHostImpl(this, process, route_id, IsHidden());
created_widgets_.insert(widget_host);
RenderWidgetHostViewPort* widget_view = RenderWidgetHostViewPort::FromRWHV(
@@ -3432,7 +3432,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 +3603,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 +3684,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());
}
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698