| OLD | NEW |
| 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 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3871 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 3871 void RenderView::DidHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 3872 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); | 3872 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); |
| 3873 } | 3873 } |
| 3874 | 3874 |
| 3875 void RenderView::OnWasHidden() { | 3875 void RenderView::OnWasHidden() { |
| 3876 RenderWidget::OnWasHidden(); | 3876 RenderWidget::OnWasHidden(); |
| 3877 | 3877 |
| 3878 if (webview()) { | 3878 if (webview()) { |
| 3879 webview()->settings()->setMinimumTimerInterval( | 3879 webview()->settings()->setMinimumTimerInterval( |
| 3880 webkit_glue::kBackgroundTabTimerInterval); | 3880 webkit_glue::kBackgroundTabTimerInterval); |
| 3881 webview()->setVisibilityState(WebKit::WebPageVisibilityStateHidden, false); | |
| 3882 } | 3881 } |
| 3883 | 3882 |
| 3884 #if defined(OS_MACOSX) | 3883 #if defined(OS_MACOSX) |
| 3885 // Inform plugins that their container is no longer visible. | 3884 // Inform plugins that their container is no longer visible. |
| 3886 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 3885 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 3887 for (plugin_it = plugin_delegates_.begin(); | 3886 for (plugin_it = plugin_delegates_.begin(); |
| 3888 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3887 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 3889 (*plugin_it)->SetContainerVisibility(false); | 3888 (*plugin_it)->SetContainerVisibility(false); |
| 3890 } | 3889 } |
| 3891 #endif // OS_MACOSX | 3890 #endif // OS_MACOSX |
| 3892 } | 3891 } |
| 3893 | 3892 |
| 3894 void RenderView::OnWasRestored(bool needs_repainting) { | 3893 void RenderView::OnWasRestored(bool needs_repainting) { |
| 3895 RenderWidget::OnWasRestored(needs_repainting); | 3894 RenderWidget::OnWasRestored(needs_repainting); |
| 3896 | 3895 |
| 3897 if (webview()) { | 3896 if (webview()) { |
| 3898 webview()->settings()->setMinimumTimerInterval( | 3897 webview()->settings()->setMinimumTimerInterval( |
| 3899 webkit_glue::kForegroundTabTimerInterval); | 3898 webkit_glue::kForegroundTabTimerInterval); |
| 3900 webview()->setVisibilityState(WebKit::WebPageVisibilityStateVisible, false); | |
| 3901 } | 3899 } |
| 3902 | 3900 |
| 3903 #if defined(OS_MACOSX) | 3901 #if defined(OS_MACOSX) |
| 3904 // Inform plugins that their container is now visible. | 3902 // Inform plugins that their container is now visible. |
| 3905 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 3903 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 3906 for (plugin_it = plugin_delegates_.begin(); | 3904 for (plugin_it = plugin_delegates_.begin(); |
| 3907 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3905 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 3908 (*plugin_it)->SetContainerVisibility(true); | 3906 (*plugin_it)->SetContainerVisibility(true); |
| 3909 } | 3907 } |
| 3910 #endif // OS_MACOSX | 3908 #endif // OS_MACOSX |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4091 if (base.GetOrigin() != absolute_url.GetOrigin()) { | 4089 if (base.GetOrigin() != absolute_url.GetOrigin()) { |
| 4092 return; | 4090 return; |
| 4093 } | 4091 } |
| 4094 RenderThread::current()->Send( | 4092 RenderThread::current()->Send( |
| 4095 new ViewHostMsg_RegisterProtocolHandler(routing_id_, | 4093 new ViewHostMsg_RegisterProtocolHandler(routing_id_, |
| 4096 UTF16ToUTF8(scheme), | 4094 UTF16ToUTF8(scheme), |
| 4097 absolute_url, | 4095 absolute_url, |
| 4098 title)); | 4096 title)); |
| 4099 } | 4097 } |
| 4100 | 4098 |
| 4101 WebKit::WebPageVisibilityState RenderView::visibilityState() const { | |
| 4102 if (is_hidden()) | |
| 4103 return WebKit::WebPageVisibilityStateHidden; | |
| 4104 else | |
| 4105 return WebKit::WebPageVisibilityStateVisible; | |
| 4106 } | |
| 4107 | |
| 4108 bool RenderView::IsNonLocalTopLevelNavigation( | 4099 bool RenderView::IsNonLocalTopLevelNavigation( |
| 4109 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { | 4100 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { |
| 4110 // Must be a top level frame. | 4101 // Must be a top level frame. |
| 4111 if (frame->parent() != NULL) | 4102 if (frame->parent() != NULL) |
| 4112 return false; | 4103 return false; |
| 4113 | 4104 |
| 4114 // Navigations initiated within Webkit are not sent out to the external host | 4105 // Navigations initiated within Webkit are not sent out to the external host |
| 4115 // in the following cases. | 4106 // in the following cases. |
| 4116 // 1. The url scheme is not http/https | 4107 // 1. The url scheme is not http/https |
| 4117 // 2. The origin of the url and the opener is the same in which case the | 4108 // 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 Loading... |
| 4191 const webkit_glue::CustomContextMenuContext& custom_context) { | 4182 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4192 if (custom_context.is_pepper_menu) | 4183 if (custom_context.is_pepper_menu) |
| 4193 pepper_delegate_.OnContextMenuClosed(custom_context); | 4184 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4194 else | 4185 else |
| 4195 context_menu_node_.reset(); | 4186 context_menu_node_.reset(); |
| 4196 } | 4187 } |
| 4197 | 4188 |
| 4198 void RenderView::OnNetworkStateChanged(bool online) { | 4189 void RenderView::OnNetworkStateChanged(bool online) { |
| 4199 WebNetworkStateNotifier::setOnLine(online); | 4190 WebNetworkStateNotifier::setOnLine(online); |
| 4200 } | 4191 } |
| OLD | NEW |