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

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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "media/video/capture/video_capture_proxy.h" 69 #include "media/video/capture/video_capture_proxy.h"
70 #include "ppapi/c/dev/pp_video_dev.h" 70 #include "ppapi/c/dev/pp_video_dev.h"
71 #include "ppapi/c/pp_errors.h" 71 #include "ppapi/c/pp_errors.h"
72 #include "ppapi/c/private/ppb_flash.h" 72 #include "ppapi/c/private/ppb_flash.h"
73 #include "ppapi/host/ppapi_host.h" 73 #include "ppapi/host/ppapi_host.h"
74 #include "ppapi/proxy/host_dispatcher.h" 74 #include "ppapi/proxy/host_dispatcher.h"
75 #include "ppapi/proxy/ppapi_messages.h" 75 #include "ppapi/proxy/ppapi_messages.h"
76 #include "ppapi/proxy/url_loader_resource.h" 76 #include "ppapi/proxy/url_loader_resource.h"
77 #include "ppapi/shared_impl/api_id.h" 77 #include "ppapi/shared_impl/api_id.h"
78 #include "ppapi/shared_impl/file_path.h" 78 #include "ppapi/shared_impl/file_path.h"
79 #include "ppapi/shared_impl/file_type_conversion.h"
79 #include "ppapi/shared_impl/platform_file.h" 80 #include "ppapi/shared_impl/platform_file.h"
80 #include "ppapi/shared_impl/ppapi_globals.h" 81 #include "ppapi/shared_impl/ppapi_globals.h"
81 #include "ppapi/shared_impl/ppapi_permissions.h" 82 #include "ppapi/shared_impl/ppapi_permissions.h"
82 #include "ppapi/shared_impl/ppapi_preferences.h" 83 #include "ppapi/shared_impl/ppapi_preferences.h"
83 #include "ppapi/shared_impl/ppb_device_ref_shared.h" 84 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
84 #include "ppapi/shared_impl/ppp_instance_combined.h" 85 #include "ppapi/shared_impl/ppp_instance_combined.h"
85 #include "ppapi/shared_impl/resource_tracker.h" 86 #include "ppapi/shared_impl/resource_tracker.h"
86 #include "ppapi/shared_impl/socket_option_data.h" 87 #include "ppapi/shared_impl/socket_option_data.h"
87 #include "ppapi/thunk/enter.h" 88 #include "ppapi/thunk/enter.h"
88 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" 89 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 if (!plugin_module) 944 if (!plugin_module)
944 return; 945 return;
945 946
946 PepperBrokerImpl* broker = 947 PepperBrokerImpl* broker =
947 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker()); 948 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker());
948 broker->OnBrokerPermissionResult(client.get(), result); 949 broker->OnBrokerPermissionResult(client.get(), result);
949 } 950 }
950 951
951 bool PepperPluginDelegateImpl::AsyncOpenFile( 952 bool PepperPluginDelegateImpl::AsyncOpenFile(
952 const base::FilePath& path, 953 const base::FilePath& path,
953 int flags, 954 int pp_open_flags,
954 const AsyncOpenFileCallback& callback) { 955 const AsyncOpenFileCallback& callback) {
955 int message_id = pending_async_open_files_.Add( 956 int message_id = pending_async_open_files_.Add(
956 new AsyncOpenFileCallback(callback)); 957 new AsyncOpenFileCallback(callback));
957 IPC::Message* msg = new ViewHostMsg_AsyncOpenFile( 958 IPC::Message* msg = new ViewHostMsg_AsyncOpenPepperFile(
958 render_view_->routing_id(), path, flags, message_id); 959 render_view_->routing_id(), path, pp_open_flags, message_id);
959 return render_view_->Send(msg); 960 return render_view_->Send(msg);
960 } 961 }
961 962
962 void PepperPluginDelegateImpl::OnAsyncFileOpened( 963 void PepperPluginDelegateImpl::OnAsyncFileOpened(
963 base::PlatformFileError error_code, 964 base::PlatformFileError error_code,
964 base::PlatformFile file, 965 base::PlatformFile file,
965 int message_id) { 966 int message_id) {
966 AsyncOpenFileCallback* callback = 967 AsyncOpenFileCallback* callback =
967 pending_async_open_files_.Lookup(message_id); 968 pending_async_open_files_.Lookup(message_id);
968 DCHECK(callback); 969 DCHECK(callback);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) { 1120 void PepperPluginDelegateImpl::WillUpdateFile(const GURL& path) {
1120 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path)); 1121 ChildThread::current()->Send(new FileSystemHostMsg_WillUpdate(path));
1121 } 1122 }
1122 1123
1123 void PepperPluginDelegateImpl::DidUpdateFile(const GURL& path, int64_t delta) { 1124 void PepperPluginDelegateImpl::DidUpdateFile(const GURL& path, int64_t delta) {
1124 ChildThread::current()->Send(new FileSystemHostMsg_DidUpdate(path, delta)); 1125 ChildThread::current()->Send(new FileSystemHostMsg_DidUpdate(path, delta));
1125 } 1126 }
1126 1127
1127 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL( 1128 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
1128 const GURL& path, 1129 const GURL& path,
1129 int flags, 1130 int pp_open_flags,
1130 const AsyncOpenFileSystemURLCallback& callback) { 1131 const AsyncOpenFileSystemURLCallback& callback) {
1132 // TODO(tommycli): Eventually just pass the Pepper flags straight to the
1133 // FileSystemDispatcher so it can handle doing the security check.
1134 int platform_file_flags = 0;
1135 if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags(
1136 pp_open_flags, &platform_file_flags)) {
1137 DidFailOpenFileSystemURL(callback, base::PLATFORM_FILE_ERROR_FAILED);
1138 return;
1139 }
1140
1131 FileSystemDispatcher* file_system_dispatcher = 1141 FileSystemDispatcher* file_system_dispatcher =
1132 ChildThread::current()->file_system_dispatcher(); 1142 ChildThread::current()->file_system_dispatcher();
1133 file_system_dispatcher->OpenFile( 1143 file_system_dispatcher->OpenFile(
1134 path, flags, 1144 path, platform_file_flags,
1135 base::Bind(&DidOpenFileSystemURL, callback), 1145 base::Bind(&DidOpenFileSystemURL, callback),
1136 base::Bind(&DidFailOpenFileSystemURL, callback)); 1146 base::Bind(&DidFailOpenFileSystemURL, callback));
1137 } 1147 }
1138 1148
1139 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( 1149 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(
1140 const GURL& url, base::FilePath* platform_path) { 1150 const GURL& url, base::FilePath* platform_path) {
1141 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( 1151 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath(
1142 url, platform_path)); 1152 url, platform_path));
1143 } 1153 }
1144 1154
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 should_close_source); 1722 should_close_source);
1713 } 1723 }
1714 1724
1715 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { 1725 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
1716 RendererPpapiHostImpl* host = 1726 RendererPpapiHostImpl* host =
1717 RendererPpapiHostImpl::GetForPPInstance(instance); 1727 RendererPpapiHostImpl::GetForPPInstance(instance);
1718 return host && host->IsRunningInProcess(); 1728 return host && host->IsRunningInProcess();
1719 } 1729 }
1720 1730
1721 } // namespace content 1731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698