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

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: Created 4 years, 7 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
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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 1306
1307 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1307 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1308 if (view) { 1308 if (view) {
1309 view->Show(); 1309 view->Show();
1310 #if defined(OS_MACOSX) 1310 #if defined(OS_MACOSX)
1311 view->SetActive(true); 1311 view->SetActive(true);
1312 #endif 1312 #endif
1313 } 1313 }
1314 } 1314 }
1315 1315
1316 SendPageMessage(new PageMsg_WasShown(MSG_ROUTING_NONE));
1317
1316 last_active_time_ = base::TimeTicks::Now(); 1318 last_active_time_ = base::TimeTicks::Now();
1317 1319
1318 // The resize rect might have changed while this was inactive -- send the new 1320 // The resize rect might have changed while this was inactive -- send the new
1319 // one to make sure it's up to date. 1321 // one to make sure it's up to date.
1320 RenderViewHostImpl* rvh = GetRenderViewHost(); 1322 RenderViewHostImpl* rvh = GetRenderViewHost();
1321 if (rvh) { 1323 if (rvh) {
1322 rvh->GetWidget()->ResizeRectChanged( 1324 rvh->GetWidget()->ResizeRectChanged(
1323 GetRootWindowResizerRect(rvh->GetWidget())); 1325 GetRootWindowResizerRect(rvh->GetWidget()));
1324 } 1326 }
1325 1327
1326 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown()); 1328 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasShown());
1327 1329
1328 should_normally_be_visible_ = true; 1330 should_normally_be_visible_ = true;
1329 } 1331 }
1330 1332
1331 void WebContentsImpl::WasHidden() { 1333 void WebContentsImpl::WasHidden() {
1332 // If there are entities capturing screenshots or video (e.g., mirroring), 1334 // If there are entities capturing screenshots or video (e.g., mirroring),
1333 // don't activate the "disable rendering" optimization. 1335 // don't activate the "disable rendering" optimization.
1334 if (capturer_count_ == 0) { 1336 if (capturer_count_ == 0) {
1335 // |GetRenderViewHost()| can be NULL if the user middle clicks a link to 1337 // |GetRenderViewHost()| can be NULL if the user middle clicks a link to
1336 // open a tab in the background, then closes the tab before selecting it. 1338 // open a tab in the background, then closes the tab before selecting it.
1337 // This is because closing the tab calls WebContentsImpl::Destroy(), which 1339 // This is because closing the tab calls WebContentsImpl::Destroy(), which
1338 // removes the |GetRenderViewHost()|; then when we actually destroy the 1340 // removes the |GetRenderViewHost()|; then when we actually destroy the
1339 // window, OnWindowPosChanged() notices and calls WasHidden() (which 1341 // window, OnWindowPosChanged() notices and calls WasHidden() (which
1340 // calls us). 1342 // calls us).
1341 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1343 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1342 if (view) 1344 if (view)
1343 view->Hide(); 1345 view->Hide();
1344 } 1346 }
1347
1348 SendPageMessage(new PageMsg_WasHidden(MSG_ROUTING_NONE));
dcheng 2016/05/24 20:38:23 MSG_ROUTING_NONE? This looks weird. Either it shou
lfg 2016/05/24 23:33:50 SendPageMessage() will attach the appropriate rout
1345 } 1349 }
1346 1350
1347 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasHidden()); 1351 FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasHidden());
1348 1352
1349 should_normally_be_visible_ = false; 1353 should_normally_be_visible_ = false;
1350 } 1354 }
1351 1355
1352 void WebContentsImpl::WasOccluded() { 1356 void WebContentsImpl::WasOccluded() {
1353 if (capturer_count_ > 0) 1357 if (capturer_count_ > 0)
1354 return; 1358 return;
(...skipping 3684 matching lines...) Expand 10 before | Expand all | Expand 10 after
5039 for (RenderViewHost* render_view_host : render_view_host_set) 5043 for (RenderViewHost* render_view_host : render_view_host_set)
5040 render_view_host->OnWebkitPreferencesChanged(); 5044 render_view_host->OnWebkitPreferencesChanged();
5041 } 5045 }
5042 5046
5043 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5047 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5044 JavaScriptDialogManager* dialog_manager) { 5048 JavaScriptDialogManager* dialog_manager) {
5045 dialog_manager_ = dialog_manager; 5049 dialog_manager_ = dialog_manager;
5046 } 5050 }
5047 5051
5048 } // namespace content 5052 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698