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

Side by Side Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 338523007: Pepper: Whitelist dev channel APIs for some apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 routing_id = GetRoutingID(instance); 286 routing_id = GetRoutingID(instance);
287 if (!routing_id) { 287 if (!routing_id) {
288 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 288 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
289 FROM_HERE, 289 FROM_HERE,
290 base::Bind(callback.func, callback.user_data, 290 base::Bind(callback.func, callback.user_data,
291 static_cast<int32_t>(PP_ERROR_FAILED))); 291 static_cast<int32_t>(PP_ERROR_FAILED)));
292 return; 292 return;
293 } 293 }
294 } 294 }
295 295
296 // If the nexe uses ppapi APIs, we have to send the document URL to the
297 // browser side when launching the host. This is so that whitelisting can be
298 // performed for specific application IDs.
299 std::string document_url_string;
300 if (uses_ppapi) {
301 content::RendererPpapiHost *host =
302 content::RendererPpapiHost::GetForPPInstance(instance);
303 if (!host) {
304 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
305 FROM_HERE,
306 base::Bind(callback.func, callback.user_data,
307 static_cast<int32_t>(PP_ERROR_FAILED)));
dmichael (off chromium) 2014/06/13 21:07:26 suggestion: Looks like you could use PostPPComplet
teravest 2014/06/13 21:13:00 Done.
308 return;
309 }
310 document_url_string = host->GetDocumentURL(instance).spec();
311 }
312
296 InstanceInfo instance_info; 313 InstanceInfo instance_info;
297 instance_info.url = GURL(alleged_url); 314 instance_info.url = GURL(alleged_url);
298 315
299 uint32_t perm_bits = ppapi::PERMISSION_NONE; 316 uint32_t perm_bits = ppapi::PERMISSION_NONE;
300 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so 317 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so
301 // it's clearer to developers when they are using 'Dev' inappropriately. We 318 // it's clearer to developers when they are using 'Dev' inappropriately. We
302 // must also check on the trusted side of the proxy. 319 // must also check on the trusted side of the proxy.
303 if (enable_ppapi_dev) 320 if (enable_ppapi_dev)
304 perm_bits |= ppapi::PERMISSION_DEV; 321 perm_bits |= ppapi::PERMISSION_DEV;
305 instance_info.permissions = 322 instance_info.permissions =
306 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); 323 ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
307 std::string error_message_string; 324 std::string error_message_string;
308 NaClLaunchResult launch_result; 325 NaClLaunchResult launch_result;
309 326
310 if (!sender->Send(new NaClHostMsg_LaunchNaCl( 327 if (!sender->Send(new NaClHostMsg_LaunchNaCl(
311 NaClLaunchParams(instance_info.url.spec(), 328 NaClLaunchParams(document_url_string,
329 instance_info.url.spec(),
312 routing_id, 330 routing_id,
313 perm_bits, 331 perm_bits,
314 PP_ToBool(uses_irt), 332 PP_ToBool(uses_irt),
315 PP_ToBool(uses_nonsfi_mode), 333 PP_ToBool(uses_nonsfi_mode),
316 PP_ToBool(enable_dyncode_syscalls), 334 PP_ToBool(enable_dyncode_syscalls),
317 PP_ToBool(enable_exception_handling), 335 PP_ToBool(enable_exception_handling),
318 PP_ToBool(enable_crash_throttling)), 336 PP_ToBool(enable_crash_throttling)),
319 &launch_result, 337 &launch_result,
320 &error_message_string))) { 338 &error_message_string))) {
321 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 339 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 &ReportSelLdrStatus 1559 &ReportSelLdrStatus
1542 }; 1560 };
1543 1561
1544 } // namespace 1562 } // namespace
1545 1563
1546 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1564 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1547 return &nacl_interface; 1565 return &nacl_interface;
1548 } 1566 }
1549 1567
1550 } // namespace nacl 1568 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698