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

Side by Side Diff: chrome/renderer/pepper/ppb_nacl_private_impl.cc

Issue 14750007: NaCl: enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment Created 7 years, 7 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 "chrome/renderer/pepper/ppb_nacl_private_impl.h" 5 #include "chrome/renderer/pepper/ppb_nacl_private_impl.h"
6 6
7 #ifndef DISABLE_NACL 7 #ifndef DISABLE_NACL
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // or is it safe to include the appropriate headers in 265 // or is it safe to include the appropriate headers in
266 // render_messages.h? 266 // render_messages.h?
267 GetRoutingID(instance), static_cast<int>(error_id)))) { 267 GetRoutingID(instance), static_cast<int>(error_id)))) {
268 return PP_NACL_FAILED; 268 return PP_NACL_FAILED;
269 } 269 }
270 return PP_NACL_OK; 270 return PP_NACL_OK;
271 } 271 }
272 272
273 PP_FileHandle OpenNaClExecutable(PP_Instance instance, 273 PP_FileHandle OpenNaClExecutable(PP_Instance instance,
274 const char* file_url, 274 const char* file_url,
275 PP_NaClExecutableMetadata* metadata) { 275 uint64_t* nonce_lo,
276 uint64_t* nonce_hi) {
276 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); 277 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit();
277 IPC::Sender* sender = content::RenderThread::Get(); 278 IPC::Sender* sender = content::RenderThread::Get();
278 if (sender == NULL) 279 if (sender == NULL)
279 sender = g_background_thread_sender.Pointer()->get(); 280 sender = g_background_thread_sender.Pointer()->get();
280 281
281 metadata->file_path = PP_MakeUndefined(); 282 *nonce_lo = 0;
283 *nonce_hi = 0;
282 base::FilePath file_path; 284 base::FilePath file_path;
283 if (!sender->Send( 285 if (!sender->Send(
284 new ChromeViewHostMsg_OpenNaClExecutable(GetRoutingID(instance), 286 new ChromeViewHostMsg_OpenNaClExecutable(GetRoutingID(instance),
285 GURL(file_url), 287 GURL(file_url),
286 &file_path, 288 &out_fd,
287 &out_fd))) { 289 nonce_lo,
290 nonce_hi))) {
288 return base::kInvalidPlatformFileValue; 291 return base::kInvalidPlatformFileValue;
289 } 292 }
290 293
291 if (out_fd == IPC::InvalidPlatformFileForTransit()) { 294 if (out_fd == IPC::InvalidPlatformFileForTransit()) {
292 return base::kInvalidPlatformFileValue; 295 return base::kInvalidPlatformFileValue;
293 } 296 }
294 297
295 metadata->file_path =
296 ppapi::StringVar::StringToPPVar(file_path.AsUTF8Unsafe());
297
298 base::PlatformFile handle = 298 base::PlatformFile handle =
299 IPC::PlatformFileForTransitToPlatformFile(out_fd); 299 IPC::PlatformFileForTransitToPlatformFile(out_fd);
300 return handle; 300 return handle;
301 } 301 }
302 302
303 const PPB_NaCl_Private nacl_interface = { 303 const PPB_NaCl_Private nacl_interface = {
304 &LaunchSelLdr, 304 &LaunchSelLdr,
305 &StartPpapiProxy, 305 &StartPpapiProxy,
306 &UrandomFD, 306 &UrandomFD,
307 &Are3DInterfacesDisabled, 307 &Are3DInterfacesDisabled,
308 &EnableBackgroundSelLdrLaunch, 308 &EnableBackgroundSelLdrLaunch,
309 &BrokerDuplicateHandle, 309 &BrokerDuplicateHandle,
310 &GetReadonlyPnaclFD, 310 &GetReadonlyPnaclFD,
311 &CreateTemporaryFile, 311 &CreateTemporaryFile,
312 &IsOffTheRecord, 312 &IsOffTheRecord,
313 &IsPnaclEnabled, 313 &IsPnaclEnabled,
314 &ReportNaClError, 314 &ReportNaClError,
315 &OpenNaClExecutable 315 &OpenNaClExecutable
316 }; 316 };
317 317
318 } // namespace 318 } // namespace
319 319
320 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { 320 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() {
321 return &nacl_interface; 321 return &nacl_interface;
322 } 322 }
323 323
324 #endif // DISABLE_NACL 324 #endif // DISABLE_NACL
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698