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

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

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 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
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 15 matching lines...) Expand all
26 #include "base/strings/string_piece.h" 26 #include "base/strings/string_piece.h"
27 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
28 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
29 #include "base/strings/sys_string_conversions.h" 29 #include "base/strings/sys_string_conversions.h"
30 #include "base/strings/utf_string_conversions.h" 30 #include "base/strings/utf_string_conversions.h"
31 #include "base/time/time.h" 31 #include "base/time/time.h"
32 #include "content/child/appcache_dispatcher.h" 32 #include "content/child/appcache_dispatcher.h"
33 #include "content/child/child_thread.h" 33 #include "content/child/child_thread.h"
34 #include "content/child/fileapi/file_system_dispatcher.h" 34 #include "content/child/fileapi/file_system_dispatcher.h"
35 #include "content/child/fileapi/webfilesystem_callback_adapters.h" 35 #include "content/child/fileapi/webfilesystem_callback_adapters.h"
36 #include "content/child/npapi/webplugin_delegate_impl.h"
36 #include "content/child/quota_dispatcher.h" 37 #include "content/child/quota_dispatcher.h"
37 #include "content/child/request_extra_data.h" 38 #include "content/child/request_extra_data.h"
38 #include "content/child/webmessageportchannel_impl.h" 39 #include "content/child/webmessageportchannel_impl.h"
39 #include "content/common/clipboard_messages.h" 40 #include "content/common/clipboard_messages.h"
40 #include "content/common/database_messages.h" 41 #include "content/common/database_messages.h"
41 #include "content/common/drag_messages.h" 42 #include "content/common/drag_messages.h"
42 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 43 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
43 #include "content/common/input_messages.h" 44 #include "content/common/input_messages.h"
44 #include "content/common/java_bridge_messages.h" 45 #include "content/common/java_bridge_messages.h"
45 #include "content/common/pepper_messages.h" 46 #include "content/common/pepper_messages.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #include "content/renderer/renderer_webcolorchooser_impl.h" 120 #include "content/renderer/renderer_webcolorchooser_impl.h"
120 #include "content/renderer/savable_resources.h" 121 #include "content/renderer/savable_resources.h"
121 #include "content/renderer/speech_recognition_dispatcher.h" 122 #include "content/renderer/speech_recognition_dispatcher.h"
122 #include "content/renderer/stats_collection_controller.h" 123 #include "content/renderer/stats_collection_controller.h"
123 #include "content/renderer/stats_collection_observer.h" 124 #include "content/renderer/stats_collection_observer.h"
124 #include "content/renderer/text_input_client_observer.h" 125 #include "content/renderer/text_input_client_observer.h"
125 #include "content/renderer/v8_value_converter_impl.h" 126 #include "content/renderer/v8_value_converter_impl.h"
126 #include "content/renderer/web_ui_extension.h" 127 #include "content/renderer/web_ui_extension.h"
127 #include "content/renderer/web_ui_extension_data.h" 128 #include "content/renderer/web_ui_extension_data.h"
128 #include "content/renderer/webplugin_delegate_proxy.h" 129 #include "content/renderer/webplugin_delegate_proxy.h"
130 #include "content/renderer/webplugin_impl.h"
129 #include "content/renderer/websharedworker_proxy.h" 131 #include "content/renderer/websharedworker_proxy.h"
130 #include "media/audio/audio_output_device.h" 132 #include "media/audio/audio_output_device.h"
131 #include "media/base/audio_renderer_mixer_input.h" 133 #include "media/base/audio_renderer_mixer_input.h"
132 #include "media/base/filter_collection.h" 134 #include "media/base/filter_collection.h"
133 #include "media/base/media_switches.h" 135 #include "media/base/media_switches.h"
134 #include "media/filters/audio_renderer_impl.h" 136 #include "media/filters/audio_renderer_impl.h"
135 #include "media/filters/gpu_video_decoder.h" 137 #include "media/filters/gpu_video_decoder.h"
136 #include "net/base/data_url.h" 138 #include "net/base/data_url.h"
137 #include "net/base/escape.h" 139 #include "net/base/escape.h"
138 #include "net/base/net_errors.h" 140 #include "net/base/net_errors.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 #include "ui/gfx/native_widget_types.h" 202 #include "ui/gfx/native_widget_types.h"
201 #include "ui/gfx/point.h" 203 #include "ui/gfx/point.h"
202 #include "ui/gfx/rect.h" 204 #include "ui/gfx/rect.h"
203 #include "ui/gfx/rect_conversions.h" 205 #include "ui/gfx/rect_conversions.h"
204 #include "ui/gfx/size_conversions.h" 206 #include "ui/gfx/size_conversions.h"
205 #include "ui/shell_dialogs/selected_file_info.h" 207 #include "ui/shell_dialogs/selected_file_info.h"
206 #include "v8/include/v8.h" 208 #include "v8/include/v8.h"
207 #include "webkit/common/dom_storage/dom_storage_types.h" 209 #include "webkit/common/dom_storage/dom_storage_types.h"
208 #include "webkit/glue/webkit_glue.h" 210 #include "webkit/glue/webkit_glue.h"
209 #include "webkit/glue/weburlresponse_extradata_impl.h" 211 #include "webkit/glue/weburlresponse_extradata_impl.h"
210 #include "webkit/plugins/npapi/plugin_list.h"
211 #include "webkit/plugins/npapi/plugin_utils.h" 212 #include "webkit/plugins/npapi/plugin_utils.h"
212 #include "webkit/plugins/npapi/webplugin_delegate.h"
213 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
214 #include "webkit/plugins/npapi/webplugin_impl.h"
215 #include "webkit/renderer/appcache/web_application_cache_host_impl.h" 213 #include "webkit/renderer/appcache/web_application_cache_host_impl.h"
216 #include "webkit/renderer/webpreferences_renderer.h" 214 #include "webkit/renderer/webpreferences_renderer.h"
217 215
218 #if defined(OS_ANDROID) 216 #if defined(OS_ANDROID)
219 #include <cpu-features.h> 217 #include <cpu-features.h>
220 218
221 #include "content/common/android/device_telephony_info.h" 219 #include "content/common/android/device_telephony_info.h"
222 #include "content/common/gpu/client/context_provider_command_buffer.h" 220 #include "content/common/gpu/client/context_provider_command_buffer.h"
223 #include "content/renderer/android/address_detector.h" 221 #include "content/renderer/android/address_detector.h"
224 #include "content/renderer/android/content_detector.h" 222 #include "content/renderer/android/content_detector.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 using WebKit::WebMouseEvent; 289 using WebKit::WebMouseEvent;
292 using WebKit::WebNavigationPolicy; 290 using WebKit::WebNavigationPolicy;
293 using WebKit::WebNavigationType; 291 using WebKit::WebNavigationType;
294 using WebKit::WebNode; 292 using WebKit::WebNode;
295 using WebKit::WebPageSerializer; 293 using WebKit::WebPageSerializer;
296 using WebKit::WebPageSerializerClient; 294 using WebKit::WebPageSerializerClient;
297 using WebKit::WebPeerConnection00Handler; 295 using WebKit::WebPeerConnection00Handler;
298 using WebKit::WebPeerConnection00HandlerClient; 296 using WebKit::WebPeerConnection00HandlerClient;
299 using WebKit::WebPeerConnectionHandler; 297 using WebKit::WebPeerConnectionHandler;
300 using WebKit::WebPeerConnectionHandlerClient; 298 using WebKit::WebPeerConnectionHandlerClient;
301 using WebKit::WebPlugin;
302 using WebKit::WebPluginAction; 299 using WebKit::WebPluginAction;
303 using WebKit::WebPluginContainer; 300 using WebKit::WebPluginContainer;
304 using WebKit::WebPluginDocument; 301 using WebKit::WebPluginDocument;
305 using WebKit::WebPluginParams; 302 using WebKit::WebPluginParams;
306 using WebKit::WebPoint; 303 using WebKit::WebPoint;
307 using WebKit::WebPopupMenuInfo; 304 using WebKit::WebPopupMenuInfo;
308 using WebKit::WebRange; 305 using WebKit::WebRange;
309 using WebKit::WebRect; 306 using WebKit::WebRect;
310 using WebKit::WebReferrerPolicy; 307 using WebKit::WebReferrerPolicy;
311 using WebKit::WebScriptSource; 308 using WebKit::WebScriptSource;
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 void RenderViewImpl::didHandleGestureEvent( 2812 void RenderViewImpl::didHandleGestureEvent(
2816 const WebGestureEvent& event, 2813 const WebGestureEvent& event,
2817 bool event_cancelled) { 2814 bool event_cancelled) {
2818 RenderWidget::didHandleGestureEvent(event, event_cancelled); 2815 RenderWidget::didHandleGestureEvent(event, event_cancelled);
2819 FOR_EACH_OBSERVER(RenderViewObserver, observers_, 2816 FOR_EACH_OBSERVER(RenderViewObserver, observers_,
2820 DidHandleGestureEvent(event)); 2817 DidHandleGestureEvent(event));
2821 } 2818 }
2822 2819
2823 // WebKit::WebFrameClient ----------------------------------------------------- 2820 // WebKit::WebFrameClient -----------------------------------------------------
2824 2821
2825 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, 2822 WebKit::WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame,
2826 const WebPluginParams& params) { 2823 const WebPluginParams& params) {
2827 WebPlugin* plugin = NULL; 2824 WebKit::WebPlugin* plugin = NULL;
2828 if (GetContentClient()->renderer()->OverrideCreatePlugin( 2825 if (GetContentClient()->renderer()->OverrideCreatePlugin(
2829 this, frame, params, &plugin)) { 2826 this, frame, params, &plugin)) {
2830 return plugin; 2827 return plugin;
2831 } 2828 }
2832 2829
2833 #if defined(ENABLE_PLUGINS) 2830 #if defined(ENABLE_PLUGINS)
2834 if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) { 2831 if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) {
2835 return GetBrowserPluginManager()->CreateBrowserPlugin(this, frame, params); 2832 return GetBrowserPluginManager()->CreateBrowserPlugin(this, frame, params);
2836 } 2833 }
2837 2834
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
4697 const WebKit::WebPluginParams& params) { 4694 const WebKit::WebPluginParams& params) {
4698 WebKit::WebPlugin* pepper_webplugin = 4695 WebKit::WebPlugin* pepper_webplugin =
4699 pepper_helper_->CreatePepperWebPlugin(info, params); 4696 pepper_helper_->CreatePepperWebPlugin(info, params);
4700 4697
4701 if (pepper_webplugin) 4698 if (pepper_webplugin)
4702 return pepper_webplugin; 4699 return pepper_webplugin;
4703 4700
4704 if (!webkit::npapi::NPAPIPluginsSupported()) 4701 if (!webkit::npapi::NPAPIPluginsSupported())
4705 return NULL; 4702 return NULL;
4706 4703
4707 return new webkit::npapi::WebPluginImpl( 4704 return new WebPluginImpl(frame, params, info.path, AsWeakPtr());
4708 frame, params, info.path, AsWeakPtr());
4709 } 4705 }
4710 4706
4711 void RenderViewImpl::EvaluateScript(const string16& frame_xpath, 4707 void RenderViewImpl::EvaluateScript(const string16& frame_xpath,
4712 const string16& jscript, 4708 const string16& jscript,
4713 int id, 4709 int id,
4714 bool notify_result) { 4710 bool notify_result) {
4715 v8::HandleScope handle_scope; 4711 v8::HandleScope handle_scope;
4716 v8::Handle<v8::Value> result; 4712 v8::Handle<v8::Value> result;
4717 WebFrame* web_frame = GetChildFrame(frame_xpath); 4713 WebFrame* web_frame = GetChildFrame(frame_xpath);
4718 if (web_frame) 4714 if (web_frame)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4777 4773
4778 void RenderViewImpl::LoadURLExternally( 4774 void RenderViewImpl::LoadURLExternally(
4779 WebKit::WebFrame* frame, 4775 WebKit::WebFrame* frame,
4780 const WebKit::WebURLRequest& request, 4776 const WebKit::WebURLRequest& request,
4781 WebKit::WebNavigationPolicy policy) { 4777 WebKit::WebNavigationPolicy policy) {
4782 loadURLExternally(frame, request, policy); 4778 loadURLExternally(frame, request, policy);
4783 } 4779 }
4784 4780
4785 // webkit_glue::WebPluginPageDelegate ------------------------------------------ 4781 // webkit_glue::WebPluginPageDelegate ------------------------------------------
4786 4782
4787 webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( 4783 WebPluginDelegate* RenderViewImpl::CreatePluginDelegate(
4788 const base::FilePath& file_path, 4784 const base::FilePath& file_path,
4789 const std::string& mime_type) { 4785 const std::string& mime_type) {
4790 if (!PluginChannelHost::IsListening()) { 4786 if (!PluginChannelHost::IsListening()) {
4791 LOG(ERROR) << "PluginChannelHost isn't listening"; 4787 LOG(ERROR) << "PluginChannelHost isn't listening";
4792 return NULL; 4788 return NULL;
4793 } 4789 }
4794 4790
4795 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); 4791 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins();
4796 if (in_process_plugin) { 4792 if (in_process_plugin) {
4797 #if defined(OS_WIN) && !defined(USE_AURA) 4793 #if defined(OS_WIN) && !defined(USE_AURA)
4798 return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type); 4794 return WebPluginDelegateImpl::Create(file_path, mime_type);
4799 #else 4795 #else
4800 // In-proc plugins aren't supported on non-Windows. 4796 // In-proc plugins aren't supported on non-Windows.
4801 NOTIMPLEMENTED(); 4797 NOTIMPLEMENTED();
4802 return NULL; 4798 return NULL;
4803 #endif 4799 #endif
4804 } 4800 }
4805 4801
4806 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); 4802 return new WebPluginDelegateProxy(mime_type, AsWeakPtr());
4807 } 4803 }
4808 4804
4809 WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement( 4805 WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement(
4810 const base::FilePath& file_path) { 4806 const base::FilePath& file_path) {
4811 return GetContentClient()->renderer()->CreatePluginReplacement( 4807 return GetContentClient()->renderer()->CreatePluginReplacement(
4812 this, file_path); 4808 this, file_path);
4813 } 4809 }
4814 4810
4815 void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) { 4811 void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) {
4816 #if defined(USE_X11) 4812 #if defined(USE_X11)
4817 Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window)); 4813 Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window));
4818 #endif 4814 #endif
4819 } 4815 }
4820 4816
4821 void RenderViewImpl::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { 4817 void RenderViewImpl::WillDestroyPluginWindow(gfx::PluginWindowHandle window) {
4822 #if defined(USE_X11) 4818 #if defined(USE_X11)
4823 Send(new ViewHostMsg_DestroyPluginContainer(routing_id(), window)); 4819 Send(new ViewHostMsg_DestroyPluginContainer(routing_id(), window));
4824 #endif 4820 #endif
4825 CleanupWindowInPluginMoves(window); 4821 CleanupWindowInPluginMoves(window);
4826 } 4822 }
4827 4823
4828 void RenderViewImpl::DidMovePlugin( 4824 void RenderViewImpl::DidMovePlugin(const WebPluginGeometry& move) {
4829 const webkit::npapi::WebPluginGeometry& move) {
4830 SchedulePluginMove(move); 4825 SchedulePluginMove(move);
4831 } 4826 }
4832 4827
4833 void RenderViewImpl::DidStartLoadingForPlugin() { 4828 void RenderViewImpl::DidStartLoadingForPlugin() {
4834 // TODO(darin): Make is_loading_ be a counter! 4829 // TODO(darin): Make is_loading_ be a counter!
4835 didStartLoading(); 4830 didStartLoading();
4836 } 4831 }
4837 4832
4838 void RenderViewImpl::DidStopLoadingForPlugin() { 4833 void RenderViewImpl::DidStopLoadingForPlugin() {
4839 // TODO(darin): Make is_loading_ be a counter! 4834 // TODO(darin): Make is_loading_ be a counter!
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
6817 WebURL url = icon_urls[i].iconURL(); 6812 WebURL url = icon_urls[i].iconURL();
6818 if (!url.isEmpty()) 6813 if (!url.isEmpty())
6819 urls.push_back(FaviconURL(url, 6814 urls.push_back(FaviconURL(url,
6820 ToFaviconType(icon_urls[i].iconType()))); 6815 ToFaviconType(icon_urls[i].iconType())));
6821 } 6816 }
6822 SendUpdateFaviconURL(urls); 6817 SendUpdateFaviconURL(urls);
6823 } 6818 }
6824 6819
6825 6820
6826 } // namespace content 6821 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698