| OLD | NEW |
| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "content/common/intents_messages.h" | 35 #include "content/common/intents_messages.h" |
| 36 #include "content/common/java_bridge_messages.h" | 36 #include "content/common/java_bridge_messages.h" |
| 37 #include "content/common/pepper_messages.h" | 37 #include "content/common/pepper_messages.h" |
| 38 #include "content/common/pepper_plugin_registry.h" | 38 #include "content/common/pepper_plugin_registry.h" |
| 39 #include "content/common/quota_dispatcher.h" | 39 #include "content/common/quota_dispatcher.h" |
| 40 #include "content/common/request_extra_data.h" | 40 #include "content/common/request_extra_data.h" |
| 41 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
| 42 #include "content/public/common/bindings_policy.h" | 42 #include "content/public/common/bindings_policy.h" |
| 43 #include "content/public/common/content_constants.h" | 43 #include "content/public/common/content_constants.h" |
| 44 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
| 45 #include "content/public/common/context_menu_params.h" |
| 45 #include "content/public/common/file_chooser_params.h" | 46 #include "content/public/common/file_chooser_params.h" |
| 46 #include "content/public/common/url_constants.h" | 47 #include "content/public/common/url_constants.h" |
| 47 #include "content/public/renderer/content_renderer_client.h" | 48 #include "content/public/renderer/content_renderer_client.h" |
| 48 #include "content/public/renderer/document_state.h" | 49 #include "content/public/renderer/document_state.h" |
| 49 #include "content/public/renderer/navigation_state.h" | 50 #include "content/public/renderer/navigation_state.h" |
| 50 #include "content/public/renderer/render_view_observer.h" | 51 #include "content/public/renderer/render_view_observer.h" |
| 51 #include "content/public/renderer/render_view_visitor.h" | 52 #include "content/public/renderer/render_view_visitor.h" |
| 52 #include "content/renderer/device_orientation_dispatcher.h" | 53 #include "content/renderer/device_orientation_dispatcher.h" |
| 53 #include "content/renderer/devtools_agent.h" | 54 #include "content/renderer/devtools_agent.h" |
| 54 #include "content/renderer/dom_automation_controller.h" | 55 #include "content/renderer/dom_automation_controller.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 #include "ui/base/javascript_message_type.h" | 146 #include "ui/base/javascript_message_type.h" |
| 146 #include "ui/gfx/native_widget_types.h" | 147 #include "ui/gfx/native_widget_types.h" |
| 147 #include "ui/gfx/point.h" | 148 #include "ui/gfx/point.h" |
| 148 #include "ui/gfx/rect.h" | 149 #include "ui/gfx/rect.h" |
| 149 #include "v8/include/v8.h" | 150 #include "v8/include/v8.h" |
| 150 #include "webkit/appcache/web_application_cache_host_impl.h" | 151 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 151 #include "webkit/forms/form_data.h" | 152 #include "webkit/forms/form_data.h" |
| 152 #include "webkit/forms/form_field.h" | 153 #include "webkit/forms/form_field.h" |
| 153 #include "webkit/forms/password_form_dom_manager.h" | 154 #include "webkit/forms/password_form_dom_manager.h" |
| 154 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 155 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 155 #include "webkit/glue/context_menu.h" | |
| 156 #include "webkit/glue/dom_operations.h" | 156 #include "webkit/glue/dom_operations.h" |
| 157 #include "webkit/glue/glue_serialize.h" | 157 #include "webkit/glue/glue_serialize.h" |
| 158 #include "webkit/glue/webdropdata.h" | 158 #include "webkit/glue/webdropdata.h" |
| 159 #include "webkit/glue/webkit_constants.h" | 159 #include "webkit/glue/webkit_constants.h" |
| 160 #include "webkit/glue/webkit_glue.h" | 160 #include "webkit/glue/webkit_glue.h" |
| 161 #include "webkit/glue/weburlloader_impl.h" | 161 #include "webkit/glue/weburlloader_impl.h" |
| 162 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 162 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 163 #include "webkit/media/webmediaplayer_impl.h" | 163 #include "webkit/media/webmediaplayer_impl.h" |
| 164 #include "webkit/plugins/npapi/plugin_list.h" | 164 #include "webkit/plugins/npapi/plugin_list.h" |
| 165 #include "webkit/plugins/npapi/webplugin_delegate.h" | 165 #include "webkit/plugins/npapi/webplugin_delegate.h" |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 // response as RunJavaScriptMessage. | 1767 // response as RunJavaScriptMessage. |
| 1768 string16 ignored_result; | 1768 string16 ignored_result; |
| 1769 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( | 1769 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( |
| 1770 routing_id_, frame->document().url(), message, | 1770 routing_id_, frame->document().url(), message, |
| 1771 &success, &ignored_result)); | 1771 &success, &ignored_result)); |
| 1772 return success; | 1772 return success; |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 void RenderViewImpl::showContextMenu( | 1775 void RenderViewImpl::showContextMenu( |
| 1776 WebFrame* frame, const WebContextMenuData& data) { | 1776 WebFrame* frame, const WebContextMenuData& data) { |
| 1777 ContextMenuParams params = ContextMenuParams(data); | 1777 content::ContextMenuParams params(data); |
| 1778 | 1778 |
| 1779 // frame is NULL if invoked by BlockedPlugin. | 1779 // frame is NULL if invoked by BlockedPlugin. |
| 1780 if (frame) | 1780 if (frame) |
| 1781 params.frame_id = frame->identifier(); | 1781 params.frame_id = frame->identifier(); |
| 1782 | 1782 |
| 1783 // Serializing a GURL longer than content::kMaxURLChars will fail, so don't do | 1783 // Serializing a GURL longer than content::kMaxURLChars will fail, so don't do |
| 1784 // it. We replace it with an empty GURL so the appropriate items are disabled | 1784 // it. We replace it with an empty GURL so the appropriate items are disabled |
| 1785 // in the context menu. | 1785 // in the context menu. |
| 1786 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large | 1786 // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large |
| 1787 // data encoded images. We should have a way to save them. | 1787 // data encoded images. We should have a way to save them. |
| (...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4056 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 4056 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
| 4057 webkit_preferences_ = prefs; | 4057 webkit_preferences_ = prefs; |
| 4058 webkit_preferences_.Apply(webview()); | 4058 webkit_preferences_.Apply(webview()); |
| 4059 } | 4059 } |
| 4060 | 4060 |
| 4061 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { | 4061 void RenderViewImpl::OnSetAltErrorPageURL(const GURL& url) { |
| 4062 alternate_error_page_url_ = url; | 4062 alternate_error_page_url_ = url; |
| 4063 } | 4063 } |
| 4064 | 4064 |
| 4065 void RenderViewImpl::OnCustomContextMenuAction( | 4065 void RenderViewImpl::OnCustomContextMenuAction( |
| 4066 const webkit_glue::CustomContextMenuContext& custom_context, | 4066 const content::CustomContextMenuContext& custom_context, |
| 4067 unsigned action) { | 4067 unsigned action) { |
| 4068 if (custom_context.is_pepper_menu) | 4068 if (custom_context.is_pepper_menu) |
| 4069 pepper_delegate_.OnCustomContextMenuAction(custom_context, action); | 4069 pepper_delegate_.OnCustomContextMenuAction(custom_context, action); |
| 4070 else | 4070 else |
| 4071 webview()->performCustomContextMenuAction(action); | 4071 webview()->performCustomContextMenuAction(action); |
| 4072 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 4072 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 4073 ContextMenuAction(action)); | 4073 ContextMenuAction(action)); |
| 4074 } | 4074 } |
| 4075 | 4075 |
| 4076 void RenderViewImpl::OnEnumerateDirectoryResponse( | 4076 void RenderViewImpl::OnEnumerateDirectoryResponse( |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5015 const PP_NetAddress_Private& remote_addr) { | 5015 const PP_NetAddress_Private& remote_addr) { |
| 5016 pepper_delegate_.OnConnectTcpACK( | 5016 pepper_delegate_.OnConnectTcpACK( |
| 5017 request_id, | 5017 request_id, |
| 5018 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), | 5018 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), |
| 5019 local_addr, | 5019 local_addr, |
| 5020 remote_addr); | 5020 remote_addr); |
| 5021 } | 5021 } |
| 5022 #endif | 5022 #endif |
| 5023 | 5023 |
| 5024 void RenderViewImpl::OnContextMenuClosed( | 5024 void RenderViewImpl::OnContextMenuClosed( |
| 5025 const webkit_glue::CustomContextMenuContext& custom_context) { | 5025 const content::CustomContextMenuContext& custom_context) { |
| 5026 if (custom_context.is_pepper_menu) | 5026 if (custom_context.is_pepper_menu) |
| 5027 pepper_delegate_.OnContextMenuClosed(custom_context); | 5027 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5028 else | 5028 else |
| 5029 context_menu_node_.reset(); | 5029 context_menu_node_.reset(); |
| 5030 } | 5030 } |
| 5031 | 5031 |
| 5032 void RenderViewImpl::OnEnableViewSourceMode() { | 5032 void RenderViewImpl::OnEnableViewSourceMode() { |
| 5033 if (!webview()) | 5033 if (!webview()) |
| 5034 return; | 5034 return; |
| 5035 WebFrame* main_frame = webview()->mainFrame(); | 5035 WebFrame* main_frame = webview()->mainFrame(); |
| 5036 if (!main_frame) | 5036 if (!main_frame) |
| 5037 return; | 5037 return; |
| 5038 main_frame->enableViewSourceMode(true); | 5038 main_frame->enableViewSourceMode(true); |
| 5039 } | 5039 } |
| 5040 | 5040 |
| 5041 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5041 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5042 return !!RenderThreadImpl::current()->compositor_thread(); | 5042 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5043 } | 5043 } |
| 5044 | 5044 |
| 5045 void RenderViewImpl::OnJavaBridgeInit() { | 5045 void RenderViewImpl::OnJavaBridgeInit() { |
| 5046 DCHECK(!java_bridge_dispatcher_.get()); | 5046 DCHECK(!java_bridge_dispatcher_.get()); |
| 5047 #if defined(ENABLE_JAVA_BRIDGE) | 5047 #if defined(ENABLE_JAVA_BRIDGE) |
| 5048 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5048 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
| 5049 #endif | 5049 #endif |
| 5050 } | 5050 } |
| OLD | NEW |