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

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

Issue 1991273003: Fire visibilityChange event on out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 5 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/site_per_process_browsertest.cc ('k') | content/common/page_messages.h » ('j') | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1283
1284 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1284 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1285 if (view) { 1285 if (view) {
1286 view->Show(); 1286 view->Show();
1287 #if defined(OS_MACOSX) 1287 #if defined(OS_MACOSX)
1288 view->SetActive(true); 1288 view->SetActive(true);
1289 #endif 1289 #endif
1290 } 1290 }
1291 } 1291 }
1292 1292
1293 SendPageMessage(new PageMsg_WasShown(MSG_ROUTING_NONE));
1294
1293 last_active_time_ = base::TimeTicks::Now(); 1295 last_active_time_ = base::TimeTicks::Now();
1294 1296
1295 // The resize rect might have changed while this was inactive -- send the new 1297 // The resize rect might have changed while this was inactive -- send the new
1296 // one to make sure it's up to date. 1298 // one to make sure it's up to date.
1297 RenderViewHostImpl* rvh = GetRenderViewHost(); 1299 RenderViewHostImpl* rvh = GetRenderViewHost();
1298 if (rvh) { 1300 if (rvh) {
1299 rvh->GetWidget()->ResizeRectChanged( 1301 rvh->GetWidget()->ResizeRectChanged(
1300 GetRootWindowResizerRect(rvh->GetWidget())); 1302 GetRootWindowResizerRect(rvh->GetWidget()));
1301 } 1303 }
1302 1304
1303 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown()); 1305 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown());
1304 1306
1305 should_normally_be_visible_ = true; 1307 should_normally_be_visible_ = true;
1306 } 1308 }
1307 1309
1308 void WebContentsImpl::WasHidden() { 1310 void WebContentsImpl::WasHidden() {
1309 // If there are entities capturing screenshots or video (e.g., mirroring), 1311 // If there are entities capturing screenshots or video (e.g., mirroring),
1310 // don't activate the "disable rendering" optimization. 1312 // don't activate the "disable rendering" optimization.
1311 if (capturer_count_ == 0) { 1313 if (capturer_count_ == 0) {
1312 // |GetRenderViewHost()| can be NULL if the user middle clicks a link to 1314 // |GetRenderViewHost()| can be NULL if the user middle clicks a link to
1313 // open a tab in the background, then closes the tab before selecting it. 1315 // open a tab in the background, then closes the tab before selecting it.
1314 // This is because closing the tab calls WebContentsImpl::Destroy(), which 1316 // This is because closing the tab calls WebContentsImpl::Destroy(), which
1315 // removes the |GetRenderViewHost()|; then when we actually destroy the 1317 // removes the |GetRenderViewHost()|; then when we actually destroy the
1316 // window, OnWindowPosChanged() notices and calls WasHidden() (which 1318 // window, OnWindowPosChanged() notices and calls WasHidden() (which
1317 // calls us). 1319 // calls us).
1318 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1320 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1319 if (view) 1321 if (view)
1320 view->Hide(); 1322 view->Hide();
1321 } 1323 }
1324
1325 SendPageMessage(new PageMsg_WasHidden(MSG_ROUTING_NONE));
1322 } 1326 }
1323 1327
1324 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasHidden()); 1328 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasHidden());
1325 1329
1326 should_normally_be_visible_ = false; 1330 should_normally_be_visible_ = false;
1327 } 1331 }
1328 1332
1329 void WebContentsImpl::WasOccluded() { 1333 void WebContentsImpl::WasOccluded() {
1330 if (capturer_count_ > 0) 1334 if (capturer_count_ > 0)
1331 return; 1335 return;
(...skipping 3793 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 for (RenderViewHost* render_view_host : render_view_host_set) 5129 for (RenderViewHost* render_view_host : render_view_host_set)
5126 render_view_host->OnWebkitPreferencesChanged(); 5130 render_view_host->OnWebkitPreferencesChanged();
5127 } 5131 }
5128 5132
5129 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5133 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5130 JavaScriptDialogManager* dialog_manager) { 5134 JavaScriptDialogManager* dialog_manager) {
5131 dialog_manager_ = dialog_manager; 5135 dialog_manager_ = dialog_manager;
5132 } 5136 }
5133 5137
5134 } // namespace content 5138 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/common/page_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698