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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use of SetWindowVisibility message Created 5 years, 8 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/renderer/render_view_impl.h ('k') | ui/aura/window_tree_host.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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 1319 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
1320 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) 1320 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu)
1321 // TODO(viettrungluu): Move to a separate message filter. 1321 // TODO(viettrungluu): Move to a separate message filter.
1322 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, 1322 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength,
1323 OnSetHistoryOffsetAndLength) 1323 OnSetHistoryOffsetAndLength)
1324 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1324 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1325 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1325 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1326 OnReleaseDisambiguationPopupBitmap) 1326 OnReleaseDisambiguationPopupBitmap)
1327 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) 1327 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw)
1328 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1328 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1329 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1329 #if defined(OS_ANDROID) 1330 #if defined(OS_ANDROID)
1330 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1331 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1331 OnActivateNearestFindResult) 1332 OnActivateNearestFindResult)
1332 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1333 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1333 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1334 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1334 OnUpdateTopControlsState) 1335 OnUpdateTopControlsState)
1335 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1336 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1336 #elif defined(OS_MACOSX) 1337 #elif defined(OS_MACOSX)
1337 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, 1338 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText,
1338 OnGetRenderedText) 1339 OnGetRenderedText)
1339 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, 1340 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted,
1340 OnPluginImeCompositionCompleted) 1341 OnPluginImeCompositionCompleted)
1341 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 1342 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
1342 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility)
1343 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) 1343 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged)
1344 #endif 1344 #endif
1345 // Adding a new message? Add platform independent ones first, then put the 1345 // Adding a new message? Add platform independent ones first, then put the
1346 // platform specific ones at the end. 1346 // platform specific ones at the end.
1347 1347
1348 // Have the super handle all other messages. 1348 // Have the super handle all other messages.
1349 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) 1349 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message))
1350 IPC_END_MESSAGE_MAP() 1350 IPC_END_MESSAGE_MAP()
1351 1351
1352 return handled; 1352 return handled;
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 3009
3010 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) 3010 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX)
3011 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3011 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3012 for (plugin_it = plugin_delegates_.begin(); 3012 for (plugin_it = plugin_delegates_.begin();
3013 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3013 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3014 (*plugin_it)->SetWindowFocus(active); 3014 (*plugin_it)->SetWindowFocus(active);
3015 } 3015 }
3016 #endif 3016 #endif
3017 } 3017 }
3018 3018
3019 void RenderViewImpl::OnSetWindowVisibility(bool visible) {
3019 #if defined(OS_MACOSX) 3020 #if defined(OS_MACOSX)
3020 void RenderViewImpl::OnSetWindowVisibility(bool visible) {
3021 #if defined(ENABLE_PLUGINS) 3021 #if defined(ENABLE_PLUGINS)
3022 // Inform plugins that their container has changed visibility. 3022 // Inform plugins that their container has changed visibility.
3023 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3023 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3024 for (plugin_it = plugin_delegates_.begin(); 3024 for (plugin_it = plugin_delegates_.begin();
3025 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3025 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3026 (*plugin_it)->SetContainerVisibility(visible); 3026 (*plugin_it)->SetContainerVisibility(visible);
3027 } 3027 }
3028 #endif 3028 #endif
3029 #else
3030 if (webview())
3031 webview()->setVisibilityState(visible ?
3032 blink::WebPageVisibilityStateVisible :
3033 blink::WebPageVisibilityStateHidden, false);
3034 #endif
3029 } 3035 }
3030 3036
3037 #if defined(OS_MACOSX)
3031 void RenderViewImpl::OnWindowFrameChanged(const gfx::Rect& window_frame, 3038 void RenderViewImpl::OnWindowFrameChanged(const gfx::Rect& window_frame,
3032 const gfx::Rect& view_frame) { 3039 const gfx::Rect& view_frame) {
3033 #if defined(ENABLE_PLUGINS) 3040 #if defined(ENABLE_PLUGINS)
3034 // Inform plugins that their window's frame has changed. 3041 // Inform plugins that their window's frame has changed.
3035 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3042 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3036 for (plugin_it = plugin_delegates_.begin(); 3043 for (plugin_it = plugin_delegates_.begin();
3037 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3044 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3038 (*plugin_it)->WindowFrameChanged(window_frame, view_frame); 3045 (*plugin_it)->WindowFrameChanged(window_frame, view_frame);
3039 } 3046 }
3040 #endif 3047 #endif
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 std::vector<gfx::Size> sizes; 3807 std::vector<gfx::Size> sizes;
3801 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3808 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3802 if (!url.isEmpty()) 3809 if (!url.isEmpty())
3803 urls.push_back( 3810 urls.push_back(
3804 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3811 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3805 } 3812 }
3806 SendUpdateFaviconURL(urls); 3813 SendUpdateFaviconURL(urls);
3807 } 3814 }
3808 3815
3809 } // namespace content 3816 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698