OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 DLOG_IF(ERROR, map.count(instance) != 0) << "Instance count should be 0"; | 460 DLOG_IF(ERROR, map.count(instance) != 0) << "Instance count should be 0"; |
461 map.add(instance, new_load_manager.Pass()); | 461 map.add(instance, new_load_manager.Pass()); |
462 } | 462 } |
463 | 463 |
464 void InstanceDestroyed(PP_Instance instance) { | 464 void InstanceDestroyed(PP_Instance instance) { |
465 NexeLoadManagerMap& map = g_load_manager_map.Get(); | 465 NexeLoadManagerMap& map = g_load_manager_map.Get(); |
466 DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID"; | 466 DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID"; |
467 map.erase(instance); | 467 map.erase(instance); |
468 } | 468 } |
469 | 469 |
470 PP_Bool NaClDebugStubEnabled() { | 470 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { |
471 return PP_FromBool(CommandLine::ForCurrentProcess()->HasSwitch( | 471 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) |
472 switches::kEnableNaClDebug)); | 472 return PP_FALSE; |
| 473 bool should_debug; |
| 474 IPC::Sender* sender = content::RenderThread::Get(); |
| 475 DCHECK(sender); |
| 476 if(!sender->Send(new NaClHostMsg_NaClDebugEnabledForURL( |
| 477 GURL(alleged_nmf_url), |
| 478 &should_debug))) { |
| 479 return PP_FALSE; |
| 480 } |
| 481 return PP_FromBool(should_debug); |
473 } | 482 } |
474 | 483 |
475 const char* GetSandboxArch() { | 484 const char* GetSandboxArch() { |
476 return nacl::GetSandboxArch(); | 485 return nacl::GetSandboxArch(); |
477 } | 486 } |
478 | 487 |
479 PP_UrlSchemeType GetUrlScheme(PP_Var url) { | 488 PP_UrlSchemeType GetUrlScheme(PP_Var url) { |
480 scoped_refptr<ppapi::StringVar> url_string = ppapi::StringVar::FromPPVar(url); | 489 scoped_refptr<ppapi::StringVar> url_string = ppapi::StringVar::FromPPVar(url); |
481 if (!url_string) | 490 if (!url_string) |
482 return PP_SCHEME_OTHER; | 491 return PP_SCHEME_OTHER; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 &GetNumberOfProcessors, | 562 &GetNumberOfProcessors, |
554 &IsNonSFIModeEnabled, | 563 &IsNonSFIModeEnabled, |
555 &GetNexeFd, | 564 &GetNexeFd, |
556 &ReportTranslationFinished, | 565 &ReportTranslationFinished, |
557 &OpenNaClExecutable, | 566 &OpenNaClExecutable, |
558 &DispatchEvent, | 567 &DispatchEvent, |
559 &SetReadOnlyProperty, | 568 &SetReadOnlyProperty, |
560 &ReportLoadError, | 569 &ReportLoadError, |
561 &InstanceCreated, | 570 &InstanceCreated, |
562 &InstanceDestroyed, | 571 &InstanceDestroyed, |
563 &NaClDebugStubEnabled, | 572 &NaClDebugEnabledForURL, |
564 &GetSandboxArch, | 573 &GetSandboxArch, |
565 &GetUrlScheme, | 574 &GetUrlScheme, |
566 &LogToConsole, | 575 &LogToConsole, |
567 &GetNexeErrorReported, | 576 &GetNexeErrorReported, |
568 &SetNexeErrorReported, | 577 &SetNexeErrorReported, |
569 &GetNaClReadyState, | 578 &GetNaClReadyState, |
570 &SetNaClReadyState, | 579 &SetNaClReadyState, |
571 &GetIsInstalled, | 580 &GetIsInstalled, |
572 &SetIsInstalled | 581 &SetIsInstalled |
573 }; | 582 }; |
574 | 583 |
575 } // namespace | 584 } // namespace |
576 | 585 |
577 namespace nacl { | 586 namespace nacl { |
578 | 587 |
579 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 588 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
580 return &nacl_interface; | 589 return &nacl_interface; |
581 } | 590 } |
582 | 591 |
583 } // namespace nacl | 592 } // namespace nacl |
OLD | NEW |