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/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util_proxy.h" | 16 #include "base/file_util_proxy.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
19 #include "base/sync_socket.h" | 19 #include "base/sync_socket.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "content/common/child_process.h" | 21 #include "content/common/child_process.h" |
22 #include "content/common/child_process_messages.h" | 22 #include "content/common/child_process_messages.h" |
23 #include "content/common/child_thread.h" | 23 #include "content/common/child_thread.h" |
24 #include "content/common/fileapi/file_system_dispatcher.h" | 24 #include "content/common/fileapi/file_system_dispatcher.h" |
25 #include "content/common/fileapi/file_system_messages.h" | 25 #include "content/common/fileapi/file_system_messages.h" |
26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
27 #include "content/common/pepper_file_messages.h" | |
28 #include "content/common/pepper_plugin_registry.h" | 27 #include "content/common/pepper_plugin_registry.h" |
29 #include "content/common/pepper_messages.h" | 28 #include "content/common/pepper_messages.h" |
30 #include "content/common/quota_dispatcher.h" | 29 #include "content/common/quota_dispatcher.h" |
31 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
32 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/context_menu_params.h" | 32 #include "content/public/common/context_menu_params.h" |
34 #include "content/public/common/media_stream_request.h" | 33 #include "content/public/common/media_stream_request.h" |
35 #include "content/public/common/referrer.h" | 34 #include "content/public/common/referrer.h" |
36 #include "content/public/renderer/content_renderer_client.h" | 35 #include "content/public/renderer/content_renderer_client.h" |
37 #include "content/renderer/browser_plugin/browser_plugin_constants.h" | 36 #include "content/renderer/browser_plugin/browser_plugin_constants.h" |
(...skipping 19 matching lines...) Expand all Loading... |
57 #include "content/renderer/renderer_clipboard_client.h" | 56 #include "content/renderer/renderer_clipboard_client.h" |
58 #include "content/renderer/renderer_restrict_dispatch_group.h" | 57 #include "content/renderer/renderer_restrict_dispatch_group.h" |
59 #include "content/renderer/webplugin_delegate_proxy.h" | 58 #include "content/renderer/webplugin_delegate_proxy.h" |
60 #include "googleurl/src/gurl.h" | 59 #include "googleurl/src/gurl.h" |
61 #include "ipc/ipc_channel_handle.h" | 60 #include "ipc/ipc_channel_handle.h" |
62 #include "media/video/capture/video_capture_proxy.h" | 61 #include "media/video/capture/video_capture_proxy.h" |
63 #include "ppapi/c/dev/pp_video_dev.h" | 62 #include "ppapi/c/dev/pp_video_dev.h" |
64 #include "ppapi/c/pp_errors.h" | 63 #include "ppapi/c/pp_errors.h" |
65 #include "ppapi/c/private/ppb_flash.h" | 64 #include "ppapi/c/private/ppb_flash.h" |
66 #include "ppapi/proxy/host_dispatcher.h" | 65 #include "ppapi/proxy/host_dispatcher.h" |
| 66 #include "ppapi/proxy/pepper_file_messages.h" |
67 #include "ppapi/proxy/ppapi_messages.h" | 67 #include "ppapi/proxy/ppapi_messages.h" |
| 68 #include "ppapi/shared_impl/file_path.h" |
68 #include "ppapi/shared_impl/platform_file.h" | 69 #include "ppapi/shared_impl/platform_file.h" |
69 #include "ppapi/shared_impl/ppapi_preferences.h" | 70 #include "ppapi/shared_impl/ppapi_preferences.h" |
70 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 71 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
71 #include "ppapi/thunk/enter.h" | 72 #include "ppapi/thunk/enter.h" |
72 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 73 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" | 76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" |
76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
82 #include "ui/gfx/size.h" | 83 #include "ui/gfx/size.h" |
83 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 84 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
84 #include "webkit/plugins/npapi/webplugin.h" | 85 #include "webkit/plugins/npapi/webplugin.h" |
85 #include "webkit/plugins/ppapi/file_path.h" | |
86 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 86 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
87 #include "webkit/plugins/ppapi/plugin_module.h" | 87 #include "webkit/plugins/ppapi/plugin_module.h" |
88 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 88 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
89 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 89 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
90 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" | 90 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" |
91 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 91 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
92 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 92 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
93 #include "webkit/plugins/ppapi/resource_helper.h" | 93 #include "webkit/plugins/ppapi/resource_helper.h" |
94 #include "webkit/plugins/webplugininfo.h" | 94 #include "webkit/plugins/webplugininfo.h" |
95 | 95 |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( | 906 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
907 const GURL& path, int flags, const AsyncOpenFileCallback& callback) { | 907 const GURL& path, int flags, const AsyncOpenFileCallback& callback) { |
908 | 908 |
909 FileSystemDispatcher* file_system_dispatcher = | 909 FileSystemDispatcher* file_system_dispatcher = |
910 ChildThread::current()->file_system_dispatcher(); | 910 ChildThread::current()->file_system_dispatcher(); |
911 return file_system_dispatcher->OpenFile(path, flags, | 911 return file_system_dispatcher->OpenFile(path, flags, |
912 new AsyncOpenFileSystemURLCallbackTranslator(callback)); | 912 new AsyncOpenFileSystemURLCallbackTranslator(callback)); |
913 } | 913 } |
914 | 914 |
915 base::PlatformFileError PepperPluginDelegateImpl::OpenFile( | 915 base::PlatformFileError PepperPluginDelegateImpl::OpenFile( |
916 const webkit::ppapi::PepperFilePath& path, | 916 const ppapi::PepperFilePath& path, |
917 int flags, | 917 int flags, |
918 base::PlatformFile* file) { | 918 base::PlatformFile* file) { |
919 IPC::PlatformFileForTransit transit_file; | 919 IPC::PlatformFileForTransit transit_file; |
920 base::PlatformFileError error; | 920 base::PlatformFileError error; |
921 IPC::Message* msg = new PepperFileMsg_OpenFile( | 921 IPC::Message* msg = new PepperFileMsg_OpenFile( |
922 path, flags, &error, &transit_file); | 922 path, flags, &error, &transit_file); |
923 if (!render_view_->Send(msg)) { | 923 if (!render_view_->Send(msg)) { |
924 *file = base::kInvalidPlatformFileValue; | 924 *file = base::kInvalidPlatformFileValue; |
925 return base::PLATFORM_FILE_ERROR_FAILED; | 925 return base::PLATFORM_FILE_ERROR_FAILED; |
926 } | 926 } |
927 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); | 927 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
928 return error; | 928 return error; |
929 } | 929 } |
930 | 930 |
931 base::PlatformFileError PepperPluginDelegateImpl::RenameFile( | 931 base::PlatformFileError PepperPluginDelegateImpl::RenameFile( |
932 const webkit::ppapi::PepperFilePath& from_path, | 932 const ppapi::PepperFilePath& from_path, |
933 const webkit::ppapi::PepperFilePath& to_path) { | 933 const ppapi::PepperFilePath& to_path) { |
934 base::PlatformFileError error; | 934 base::PlatformFileError error; |
935 IPC::Message* msg = new PepperFileMsg_RenameFile(from_path, to_path, &error); | 935 IPC::Message* msg = new PepperFileMsg_RenameFile(from_path, to_path, &error); |
936 if (!render_view_->Send(msg)) | 936 if (!render_view_->Send(msg)) |
937 return base::PLATFORM_FILE_ERROR_FAILED; | 937 return base::PLATFORM_FILE_ERROR_FAILED; |
938 return error; | 938 return error; |
939 } | 939 } |
940 | 940 |
941 base::PlatformFileError PepperPluginDelegateImpl::DeleteFileOrDir( | 941 base::PlatformFileError PepperPluginDelegateImpl::DeleteFileOrDir( |
942 const webkit::ppapi::PepperFilePath& path, | 942 const ppapi::PepperFilePath& path, |
943 bool recursive) { | 943 bool recursive) { |
944 base::PlatformFileError error; | 944 base::PlatformFileError error; |
945 IPC::Message* msg = new PepperFileMsg_DeleteFileOrDir( | 945 IPC::Message* msg = new PepperFileMsg_DeleteFileOrDir( |
946 path, recursive, &error); | 946 path, recursive, &error); |
947 if (!render_view_->Send(msg)) | 947 if (!render_view_->Send(msg)) |
948 return base::PLATFORM_FILE_ERROR_FAILED; | 948 return base::PLATFORM_FILE_ERROR_FAILED; |
949 return error; | 949 return error; |
950 } | 950 } |
951 | 951 |
952 base::PlatformFileError PepperPluginDelegateImpl::CreateDir( | 952 base::PlatformFileError PepperPluginDelegateImpl::CreateDir( |
953 const webkit::ppapi::PepperFilePath& path) { | 953 const ppapi::PepperFilePath& path) { |
954 base::PlatformFileError error; | 954 base::PlatformFileError error; |
955 IPC::Message* msg = new PepperFileMsg_CreateDir(path, &error); | 955 IPC::Message* msg = new PepperFileMsg_CreateDir(path, &error); |
956 if (!render_view_->Send(msg)) | 956 if (!render_view_->Send(msg)) |
957 return base::PLATFORM_FILE_ERROR_FAILED; | 957 return base::PLATFORM_FILE_ERROR_FAILED; |
958 return error; | 958 return error; |
959 } | 959 } |
960 | 960 |
961 base::PlatformFileError PepperPluginDelegateImpl::QueryFile( | 961 base::PlatformFileError PepperPluginDelegateImpl::QueryFile( |
962 const webkit::ppapi::PepperFilePath& path, | 962 const ppapi::PepperFilePath& path, |
963 base::PlatformFileInfo* info) { | 963 base::PlatformFileInfo* info) { |
964 base::PlatformFileError error; | 964 base::PlatformFileError error; |
965 IPC::Message* msg = new PepperFileMsg_QueryFile(path, info, &error); | 965 IPC::Message* msg = new PepperFileMsg_QueryFile(path, info, &error); |
966 if (!render_view_->Send(msg)) | 966 if (!render_view_->Send(msg)) |
967 return base::PLATFORM_FILE_ERROR_FAILED; | 967 return base::PLATFORM_FILE_ERROR_FAILED; |
968 return error; | 968 return error; |
969 } | 969 } |
970 | 970 |
971 base::PlatformFileError PepperPluginDelegateImpl::GetDirContents( | 971 base::PlatformFileError PepperPluginDelegateImpl::GetDirContents( |
972 const webkit::ppapi::PepperFilePath& path, | 972 const ppapi::PepperFilePath& path, |
973 webkit::ppapi::DirContents* contents) { | 973 ppapi::DirContents* contents) { |
974 base::PlatformFileError error; | 974 base::PlatformFileError error; |
975 IPC::Message* msg = new PepperFileMsg_GetDirContents(path, contents, &error); | 975 IPC::Message* msg = new PepperFileMsg_GetDirContents(path, contents, &error); |
976 if (!render_view_->Send(msg)) | 976 if (!render_view_->Send(msg)) |
977 return base::PLATFORM_FILE_ERROR_FAILED; | 977 return base::PLATFORM_FILE_ERROR_FAILED; |
978 return error; | 978 return error; |
979 } | 979 } |
980 | 980 |
981 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( | 981 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( |
982 const GURL& url, FilePath* platform_path) { | 982 const GURL& url, FilePath* platform_path) { |
983 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( | 983 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 else | 1691 else |
1692 return render_view_->mouse_lock_dispatcher(); | 1692 return render_view_->mouse_lock_dispatcher(); |
1693 } | 1693 } |
1694 | 1694 |
1695 webkit_glue::ClipboardClient* | 1695 webkit_glue::ClipboardClient* |
1696 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1696 PepperPluginDelegateImpl::CreateClipboardClient() const { |
1697 return new RendererClipboardClient; | 1697 return new RendererClipboardClient; |
1698 } | 1698 } |
1699 | 1699 |
1700 } // namespace content | 1700 } // namespace content |
OLD | NEW |