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

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

Issue 7036019: Enabling page visibility api in the chrome browser. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Synced for commit. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 3870 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { 3881 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {
3882 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); 3882 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event));
3883 } 3883 }
3884 3884
3885 void RenderView::OnWasHidden() { 3885 void RenderView::OnWasHidden() {
3886 RenderWidget::OnWasHidden(); 3886 RenderWidget::OnWasHidden();
3887 3887
3888 if (webview()) { 3888 if (webview()) {
3889 webview()->settings()->setMinimumTimerInterval( 3889 webview()->settings()->setMinimumTimerInterval(
3890 webkit_glue::kBackgroundTabTimerInterval); 3890 webkit_glue::kBackgroundTabTimerInterval);
3891 webview()->setVisibilityState(WebKit::WebPageVisibilityStateHidden, false);
3891 } 3892 }
3892 3893
3893 #if defined(OS_MACOSX) 3894 #if defined(OS_MACOSX)
3894 // Inform plugins that their container is no longer visible. 3895 // Inform plugins that their container is no longer visible.
3895 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3896 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3896 for (plugin_it = plugin_delegates_.begin(); 3897 for (plugin_it = plugin_delegates_.begin();
3897 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3898 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3898 (*plugin_it)->SetContainerVisibility(false); 3899 (*plugin_it)->SetContainerVisibility(false);
3899 } 3900 }
3900 #endif // OS_MACOSX 3901 #endif // OS_MACOSX
3901 } 3902 }
3902 3903
3903 void RenderView::OnWasRestored(bool needs_repainting) { 3904 void RenderView::OnWasRestored(bool needs_repainting) {
3904 RenderWidget::OnWasRestored(needs_repainting); 3905 RenderWidget::OnWasRestored(needs_repainting);
3905 3906
3906 if (webview()) { 3907 if (webview()) {
3907 webview()->settings()->setMinimumTimerInterval( 3908 webview()->settings()->setMinimumTimerInterval(
3908 webkit_glue::kForegroundTabTimerInterval); 3909 webkit_glue::kForegroundTabTimerInterval);
3910 webview()->setVisibilityState(WebKit::WebPageVisibilityStateVisible, false);
3909 } 3911 }
3910 3912
3911 #if defined(OS_MACOSX) 3913 #if defined(OS_MACOSX)
3912 // Inform plugins that their container is now visible. 3914 // Inform plugins that their container is now visible.
3913 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3915 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3914 for (plugin_it = plugin_delegates_.begin(); 3916 for (plugin_it = plugin_delegates_.begin();
3915 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3917 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3916 (*plugin_it)->SetContainerVisibility(true); 3918 (*plugin_it)->SetContainerVisibility(true);
3917 } 3919 }
3918 #endif // OS_MACOSX 3920 #endif // OS_MACOSX
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 if (base.GetOrigin() != absolute_url.GetOrigin()) { 4101 if (base.GetOrigin() != absolute_url.GetOrigin()) {
4100 return; 4102 return;
4101 } 4103 }
4102 RenderThread::current()->Send( 4104 RenderThread::current()->Send(
4103 new ViewHostMsg_RegisterProtocolHandler(routing_id_, 4105 new ViewHostMsg_RegisterProtocolHandler(routing_id_,
4104 UTF16ToUTF8(scheme), 4106 UTF16ToUTF8(scheme),
4105 absolute_url, 4107 absolute_url,
4106 title)); 4108 title));
4107 } 4109 }
4108 4110
4111 WebKit::WebPageVisibilityState RenderView::visibilityState() const {
4112 if (is_hidden())
4113 return WebKit::WebPageVisibilityStateHidden;
4114 else
4115 return WebKit::WebPageVisibilityStateVisible;
4116 }
4117
4109 bool RenderView::IsNonLocalTopLevelNavigation( 4118 bool RenderView::IsNonLocalTopLevelNavigation(
4110 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { 4119 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) {
4111 // Must be a top level frame. 4120 // Must be a top level frame.
4112 if (frame->parent() != NULL) 4121 if (frame->parent() != NULL)
4113 return false; 4122 return false;
4114 4123
4115 // Navigations initiated within Webkit are not sent out to the external host 4124 // Navigations initiated within Webkit are not sent out to the external host
4116 // in the following cases. 4125 // in the following cases.
4117 // 1. The url scheme is not http/https 4126 // 1. The url scheme is not http/https
4118 // 2. The origin of the url and the opener is the same in which case the 4127 // 2. The origin of the url and the opener is the same in which case the
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 const webkit_glue::CustomContextMenuContext& custom_context) { 4201 const webkit_glue::CustomContextMenuContext& custom_context) {
4193 if (custom_context.is_pepper_menu) 4202 if (custom_context.is_pepper_menu)
4194 pepper_delegate_.OnContextMenuClosed(custom_context); 4203 pepper_delegate_.OnContextMenuClosed(custom_context);
4195 else 4204 else
4196 context_menu_node_.reset(); 4205 context_menu_node_.reset();
4197 } 4206 }
4198 4207
4199 void RenderView::OnNetworkStateChanged(bool online) { 4208 void RenderView::OnNetworkStateChanged(bool online) {
4200 WebNetworkStateNotifier::setOnLine(online); 4209 WebNetworkStateNotifier::setOnLine(online);
4201 } 4210 }
OLDNEW
« no previous file with comments | « content/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698