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 #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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "components/nacl/common/nacl_host_messages.h" | 14 #include "components/nacl/common/nacl_host_messages.h" |
| 15 #include "components/nacl/common/nacl_switches.h" |
15 #include "components/nacl/common/nacl_types.h" | 16 #include "components/nacl/common/nacl_types.h" |
16 #include "components/nacl/renderer/pnacl_translation_resource_host.h" | 17 #include "components/nacl/renderer/pnacl_translation_resource_host.h" |
17 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
18 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/sandbox_init.h" | 20 #include "content/public/common/sandbox_init.h" |
20 #include "content/public/renderer/pepper_plugin_instance.h" | 21 #include "content/public/renderer/pepper_plugin_instance.h" |
21 #include "content/public/renderer/render_thread.h" | 22 #include "content/public/renderer/render_thread.h" |
22 #include "content/public/renderer/render_view.h" | 23 #include "content/public/renderer/render_view.h" |
23 #include "content/public/renderer/renderer_ppapi_host.h" | 24 #include "content/public/renderer/renderer_ppapi_host.h" |
24 #include "ppapi/c/pp_bool.h" | 25 #include "ppapi/c/pp_bool.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 DispatchEvent(instance, PP_NACL_EVENT_LOADEND, NULL, PP_FALSE, 0, 0); | 500 DispatchEvent(instance, PP_NACL_EVENT_LOADEND, NULL, PP_FALSE, 0, 0); |
500 | 501 |
501 HistogramEnumerate("NaCl.LoadStatus.Plugin", error, | 502 HistogramEnumerate("NaCl.LoadStatus.Plugin", error, |
502 PP_NACL_ERROR_MAX); | 503 PP_NACL_ERROR_MAX); |
503 std::string uma_name = (is_installed == PP_TRUE) ? | 504 std::string uma_name = (is_installed == PP_TRUE) ? |
504 "NaCl.LoadStatus.Plugin.InstalledApp" : | 505 "NaCl.LoadStatus.Plugin.InstalledApp" : |
505 "NaCl.LoadStatus.Plugin.NotInstalledApp"; | 506 "NaCl.LoadStatus.Plugin.NotInstalledApp"; |
506 HistogramEnumerate(uma_name, error, PP_NACL_ERROR_MAX); | 507 HistogramEnumerate(uma_name, error, PP_NACL_ERROR_MAX); |
507 } | 508 } |
508 | 509 |
| 510 PP_Bool NaClDebugStubEnabled() { |
| 511 return PP_FromBool(CommandLine::ForCurrentProcess()->HasSwitch( |
| 512 switches::kEnableNaClDebug)); |
| 513 } |
| 514 |
509 const PPB_NaCl_Private nacl_interface = { | 515 const PPB_NaCl_Private nacl_interface = { |
510 &LaunchSelLdr, | 516 &LaunchSelLdr, |
511 &StartPpapiProxy, | 517 &StartPpapiProxy, |
512 &UrandomFD, | 518 &UrandomFD, |
513 &Are3DInterfacesDisabled, | 519 &Are3DInterfacesDisabled, |
514 &BrokerDuplicateHandle, | 520 &BrokerDuplicateHandle, |
515 &GetReadonlyPnaclFD, | 521 &GetReadonlyPnaclFD, |
516 &CreateTemporaryFile, | 522 &CreateTemporaryFile, |
517 &GetNumberOfProcessors, | 523 &GetNumberOfProcessors, |
518 &GetNexeFd, | 524 &GetNexeFd, |
519 &ReportTranslationFinished, | 525 &ReportTranslationFinished, |
520 &OpenNaClExecutable, | 526 &OpenNaClExecutable, |
521 &DispatchEvent, | 527 &DispatchEvent, |
522 &SetReadOnlyProperty, | 528 &SetReadOnlyProperty, |
523 &ReportLoadError | 529 &ReportLoadError, |
| 530 &NaClDebugStubEnabled |
524 }; | 531 }; |
525 | 532 |
526 } // namespace | 533 } // namespace |
527 | 534 |
528 namespace nacl { | 535 namespace nacl { |
529 | 536 |
530 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 537 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
531 return &nacl_interface; | 538 return &nacl_interface; |
532 } | 539 } |
533 | 540 |
534 } // namespace nacl | 541 } // namespace nacl |
535 | 542 |
536 #endif // DISABLE_NACL | 543 #endif // DISABLE_NACL |
OLD | NEW |