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

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 19723010: Pepper Message Filters: Port to use explicit permission grants in ChildProcessSecurityPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0044-write-support-remove-child-process-security-policy-bitmask-usage
Patch Set: 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
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/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>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "media/video/capture/video_capture_proxy.h" 68 #include "media/video/capture/video_capture_proxy.h"
69 #include "ppapi/c/dev/pp_video_dev.h" 69 #include "ppapi/c/dev/pp_video_dev.h"
70 #include "ppapi/c/pp_errors.h" 70 #include "ppapi/c/pp_errors.h"
71 #include "ppapi/c/private/ppb_flash.h" 71 #include "ppapi/c/private/ppb_flash.h"
72 #include "ppapi/host/ppapi_host.h" 72 #include "ppapi/host/ppapi_host.h"
73 #include "ppapi/proxy/host_dispatcher.h" 73 #include "ppapi/proxy/host_dispatcher.h"
74 #include "ppapi/proxy/ppapi_messages.h" 74 #include "ppapi/proxy/ppapi_messages.h"
75 #include "ppapi/proxy/url_loader_resource.h" 75 #include "ppapi/proxy/url_loader_resource.h"
76 #include "ppapi/shared_impl/api_id.h" 76 #include "ppapi/shared_impl/api_id.h"
77 #include "ppapi/shared_impl/file_path.h" 77 #include "ppapi/shared_impl/file_path.h"
78 #include "ppapi/shared_impl/file_type_conversion.h"
78 #include "ppapi/shared_impl/platform_file.h" 79 #include "ppapi/shared_impl/platform_file.h"
79 #include "ppapi/shared_impl/ppapi_globals.h" 80 #include "ppapi/shared_impl/ppapi_globals.h"
80 #include "ppapi/shared_impl/ppapi_permissions.h" 81 #include "ppapi/shared_impl/ppapi_permissions.h"
81 #include "ppapi/shared_impl/ppapi_preferences.h" 82 #include "ppapi/shared_impl/ppapi_preferences.h"
82 #include "ppapi/shared_impl/ppb_device_ref_shared.h" 83 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
83 #include "ppapi/shared_impl/ppp_instance_combined.h" 84 #include "ppapi/shared_impl/ppp_instance_combined.h"
84 #include "ppapi/shared_impl/resource_tracker.h" 85 #include "ppapi/shared_impl/resource_tracker.h"
85 #include "ppapi/shared_impl/socket_option_data.h" 86 #include "ppapi/shared_impl/socket_option_data.h"
86 #include "ppapi/thunk/enter.h" 87 #include "ppapi/thunk/enter.h"
87 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" 88 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 if (!plugin_module) 943 if (!plugin_module)
943 return; 944 return;
944 945
945 PepperBrokerImpl* broker = 946 PepperBrokerImpl* broker =
946 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker()); 947 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker());
947 broker->OnBrokerPermissionResult(client.get(), result); 948 broker->OnBrokerPermissionResult(client.get(), result);
948 } 949 }
949 950
950 bool PepperPluginDelegateImpl::AsyncOpenFile( 951 bool PepperPluginDelegateImpl::AsyncOpenFile(
951 const base::FilePath& path, 952 const base::FilePath& path,
952 int flags, 953 int pp_open_flags,
953 const AsyncOpenFileCallback& callback) { 954 const AsyncOpenFileCallback& callback) {
954 int message_id = pending_async_open_files_.Add( 955 int message_id = pending_async_open_files_.Add(
955 new AsyncOpenFileCallback(callback)); 956 new AsyncOpenFileCallback(callback));
956 IPC::Message* msg = new ViewHostMsg_AsyncOpenFile( 957 IPC::Message* msg = new ViewHostMsg_AsyncOpenPepperFile(
957 render_view_->routing_id(), path, flags, message_id); 958 render_view_->routing_id(), path, pp_open_flags, message_id);
958 return render_view_->Send(msg); 959 return render_view_->Send(msg);
959 } 960 }
960 961
961 void PepperPluginDelegateImpl::OnAsyncFileOpened( 962 void PepperPluginDelegateImpl::OnAsyncFileOpened(
962 base::PlatformFileError error_code, 963 base::PlatformFileError error_code,
963 base::PlatformFile file, 964 base::PlatformFile file,
964 int message_id) { 965 int message_id) {
965 AsyncOpenFileCallback* callback = 966 AsyncOpenFileCallback* callback =
966 pending_async_open_files_.Lookup(message_id); 967 pending_async_open_files_.Lookup(message_id);
967 DCHECK(callback); 968 DCHECK(callback);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) { 1119 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) {
1119 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path)); 1120 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path));
1120 } 1121 }
1121 1122
1122 void PepperPluginDelegateImpl::DidUpdateFile(const GURL& path, int64_t delta) { 1123 void PepperPluginDelegateImpl::DidUpdateFile(const GURL& path, int64_t delta) {
1123 ChildThread::current()->Send(new FileSystemHostMsg_DidUpdate(path, delta)); 1124 ChildThread::current()->Send(new FileSystemHostMsg_DidUpdate(path, delta));
1124 } 1125 }
1125 1126
1126 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL( 1127 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
1127 const GURL& path, 1128 const GURL& path,
1128 int flags, 1129 int pp_open_flags,
1129 const AsyncOpenFileSystemURLCallback& callback) { 1130 const AsyncOpenFileSystemURLCallback& callback) {
1131 // TODO(tommycli): Eventually just pass the Pepper flags straight to the
1132 // FileSystemDispatcher so it can handle doing the security check.
1133 int platform_file_flags = 0;
1134 if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags(
1135 pp_open_flags, &platform_file_flags)) {
1136 DidFailOpenFileSystemURL(callback, base::PLATFORM_FILE_ERROR_FAILED);
1137 return;
1138 }
1139
1130 FileSystemDispatcher* file_system_dispatcher = 1140 FileSystemDispatcher* file_system_dispatcher =
1131 ChildThread::current()->file_system_dispatcher(); 1141 ChildThread::current()->file_system_dispatcher();
1132 file_system_dispatcher->OpenFile( 1142 file_system_dispatcher->OpenFile(
1133 path, flags, 1143 path, platform_file_flags,
1134 base::Bind(&DidOpenFileSystemURL, callback), 1144 base::Bind(&DidOpenFileSystemURL, callback),
1135 base::Bind(&DidFailOpenFileSystemURL, callback)); 1145 base::Bind(&DidFailOpenFileSystemURL, callback));
1136 } 1146 }
1137 1147
1138 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( 1148 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(
1139 const GURL& url, base::FilePath* platform_path) { 1149 const GURL& url, base::FilePath* platform_path) {
1140 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( 1150 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath(
1141 url, platform_path)); 1151 url, platform_path));
1142 } 1152 }
1143 1153
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 should_close_source); 1700 should_close_source);
1691 } 1701 }
1692 1702
1693 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { 1703 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
1694 RendererPpapiHostImpl* host = 1704 RendererPpapiHostImpl* host =
1695 RendererPpapiHostImpl::GetForPPInstance(instance); 1705 RendererPpapiHostImpl::GetForPPInstance(instance);
1696 return host && host->IsRunningInProcess(); 1706 return host && host->IsRunningInProcess();
1697 } 1707 }
1698 1708
1699 } // namespace content 1709 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698