diff options
author | yael.aharon@intel.com <yael.aharon@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 23:17:52 +0000 |
---|---|---|
committer | yael.aharon@intel.com <yael.aharon@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 23:17:52 +0000 |
commit | d2e2ccf29df48310fbffb3b9d38463872bd28d17 (patch) | |
tree | 402d66dea9e363d2b99993aca326bf17b46944ea | |
parent | 30a0d4c9ac288cb5a63a6ccb0c430b2cb1f3739c (diff) | |
download | chromium_src-d2e2ccf29df48310fbffb3b9d38463872bd28d17.zip chromium_src-d2e2ccf29df48310fbffb3b9d38463872bd28d17.tar.gz chromium_src-d2e2ccf29df48310fbffb3b9d38463872bd28d17.tar.bz2 |
Separate NaCl switches to their own file.
This is part of an effort to componentize NaCl code.
BUG=244791
Review URL: https://chromiumcodereview.appspot.com/17379019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207951 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 145 insertions, 41 deletions
diff --git a/chrome/app/DEPS b/chrome/app/DEPS index 37cd670..77f6a4b 100644 --- a/chrome/app/DEPS +++ b/chrome/app/DEPS @@ -8,6 +8,7 @@ include_rules = [ "+chrome/utility/chrome_content_utility_client.h", "+chromeos/chromeos_paths.h", "+components/breakpad/common/breakpad_paths.h", + "+components/nacl/common", "+content/public/app", "+content/public/browser/browser_main_runner.h", "+content/public/browser/render_process_host.h", diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm index 1a39ad5..134b9c0 100644 --- a/chrome/app/breakpad_mac.mm +++ b/chrome/app/breakpad_mac.mm @@ -32,6 +32,7 @@ #include "chrome/common/logging_chrome.h" #include "chrome/installer/util/google_update_settings.h" #include "components/breakpad/common/breakpad_paths.h" +#include "components/nacl/common/nacl_switches.h" #include "native_client/src/trusted/service_runtime/osx/crash_filter.h" #include "policy/policy_constants.h" diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 06f8c17..eef9d15 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -30,6 +30,7 @@ #include "chrome/plugin/chrome_content_plugin_client.h" #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/utility/chrome_content_utility_client.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/common/content_client.h" #include "content/public/common/content_paths.h" #include "ui/base/ui_base_switches.h" @@ -528,12 +529,20 @@ void ChromeMainDelegate::PreSandboxStartup() { // Initialize ResourceBundle which handles files loaded from external // sources. The language should have been passed in to us from the // browser process as a command line flag. +#if defined(DISABLE_NACL) + DCHECK(command_line.HasSwitch(switches::kLang) || + process_type == switches::kZygoteProcess || + process_type == switches::kGpuProcess || + process_type == switches::kPpapiBrokerProcess || + process_type == switches::kPpapiPluginProcess); +#else DCHECK(command_line.HasSwitch(switches::kLang) || process_type == switches::kZygoteProcess || process_type == switches::kGpuProcess || process_type == switches::kNaClLoaderProcess || process_type == switches::kPpapiBrokerProcess || process_type == switches::kPpapiPluginProcess); +#endif // TODO(markusheintz): The command line flag --lang is actually processed // by the CommandLinePrefStore, and made available through the PrefService diff --git a/chrome/app/nacl_fork_delegate_linux.cc b/chrome/app/nacl_fork_delegate_linux.cc index c16603d..97bf1fd 100644 --- a/chrome/app/nacl_fork_delegate_linux.cc +++ b/chrome/app/nacl_fork_delegate_linux.cc @@ -21,8 +21,8 @@ #include "base/process_util.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/nacl_helper_linux.h" +#include "components/nacl/common/nacl_switches.h" NaClForkDelegate::NaClForkDelegate() : status_(kNaClHelperUnused), diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index db1ffd7..d120548 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -11,6 +11,7 @@ include_rules = [ "+components/auto_login_parser", "+components/breakpad", "+components/browser_context_keyed_service", + "+components/nacl/common", "+components/navigation_interception", "+components/user_prefs", "+components/visitedlink/browser", diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 6e7add7..9f9c41a 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -19,6 +19,7 @@ #include "chrome/browser/flags_storage.h" #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_switches.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/browser/user_metrics.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc index b8d2c4f..74e4161 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc @@ -14,6 +14,7 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_messages.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/child_process_data.h" #include "content/public/common/child_process_host.h" diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 05cec37..d52ffca 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -36,6 +36,7 @@ #include "chrome/common/nacl_host_messages.h" #include "chrome/common/nacl_messages.h" #include "chrome/common/render_messages.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/child_process_data.h" diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index 141008e..7f36426 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -9,6 +9,7 @@ #include "base/win/windows_version.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ppapi/ppapi_test.h" +#include "components/nacl/common/nacl_switches.h" static const base::FilePath::CharType kMockNaClGdb[] = #if defined(OS_WIN) diff --git a/chrome/common/DEPS b/chrome/common/DEPS index 70cdc98..3e8aa9b 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+chromeos", # For chromeos_switches.h "+components/autofill/core/common", "+components/breakpad/common", + "+components/nacl/common", "+device/bluetooth", # For BluetoothDevicePermission "+device/media_transfer_protocol", # For MediaTransferProtocolManager "+device/usb", # For UsbDevicePermission diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc index 5eb6591..337f9b9 100644 --- a/chrome/common/chrome_paths_win.cc +++ b/chrome/common/chrome_paths_win.cc @@ -17,6 +17,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/util/browser_distribution.h" +#include "components/nacl/common/nacl_switches.h" namespace chrome { diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 641115e..64cb4e8 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -912,33 +912,6 @@ const char kMetricsRecordingOnly[] = "metrics-recording-only"; // Enables multiprofile Chrome. const char kMultiProfiles[] = "multi-profiles"; -// Causes the process to run as a NativeClient broker -// (used for launching NaCl loader processes on 64-bit Windows). -const char kNaClBrokerProcess[] = "nacl-broker"; - -// Uses NaCl manifest URL to choose whether NaCl program will be debugged by -// debug stub. -// Switch value format: [!]pattern1,pattern2,...,patternN. Each pattern uses -// the same syntax as patterns in Chrome extension manifest. The only difference -// is that * scheme matches all schemes instead of matching only http and https. -// If the value doesn't start with !, a program will be debugged if manifest URL -// matches any pattern. If the value starts with !, a program will be debugged -// if manifest URL does not match any pattern. -const char kNaClDebugMask[] = "nacl-debug-mask"; - -// Native Client GDB debugger that will be launched automatically when needed. -const char kNaClGdb[] = "nacl-gdb"; - -// GDB script to pass to the nacl-gdb debugger at startup. -const char kNaClGdbScript[] = "nacl-gdb-script"; - -// Causes the process to run as a NativeClient loader. -const char kNaClLoaderProcess[] = "nacl-loader"; - -// On POSIX only: the contents of this flag are prepended to the nacl-loader -// command line. Useful values might be "valgrind" or "xterm -e gdb --args". -const char kNaClLoaderCmdPrefix[] = "nacl-loader-cmd-prefix"; - // List of native messaging hosts outside of the default location. Used for // tests. The value must be comma-separate lists of key-value pairs separated // equal sign. E.g. "host1=/path/to/host1/manifest.json,host2=/path/host2.json". @@ -1411,9 +1384,6 @@ const char kTabCapture[] = "enable-tab-capture"; // Passes the name of the current running automated test to Chrome. const char kTestName[] = "test-name"; -// Runs the security test for the NaCl loader sandbox. -const char kTestNaClSandbox[] = "test-nacl-sandbox"; - // Type of the current test harness ("browser" or "ui"). const char kTestType[] = "test-type"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 532880c..7958283 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -249,12 +249,6 @@ extern const char kMemoryProfiling[]; extern const char kMessageLoopHistogrammer[]; extern const char kMetricsRecordingOnly[]; extern const char kMultiProfiles[]; -extern const char kNaClBrokerProcess[]; -extern const char kNaClDebugMask[]; -extern const char kNaClGdb[]; -extern const char kNaClGdbScript[]; -extern const char kNaClLoaderCmdPrefix[]; -extern const char kNaClLoaderProcess[]; extern const char kNativeMessagingHosts[]; extern const char kNetLogLevel[]; extern const char kNewProfileManagement[]; @@ -372,7 +366,6 @@ extern const char kSyncDisableOAuth2Token[]; extern const char kSyncfsEnableDirectoryOperation[]; extern const char kTabBrowserDragging[]; extern const char kTabCapture[]; -extern const char kTestNaClSandbox[]; extern const char kTestName[]; extern const char kTestType[]; extern const char kTestingChannelID[]; diff --git a/chrome/common/nacl_cmd_line.cc b/chrome/common/nacl_cmd_line.cc index 05c8af6..9fb1a0e 100644 --- a/chrome/common/nacl_cmd_line.cc +++ b/chrome/common/nacl_cmd_line.cc @@ -5,6 +5,8 @@ #include "base/basictypes.h" #include "base/command_line.h" #include "chrome/common/chrome_switches.h" +#include "components/nacl/common/nacl_switches.h" +#include "content/public/common/content_switches.h" namespace nacl { diff --git a/chrome/common_constants.gyp b/chrome/common_constants.gyp index 7020f80..fefe2da 100644 --- a/chrome/common_constants.gyp +++ b/chrome/common_constants.gyp @@ -82,6 +82,11 @@ ['toolkit_uses_gtk == 1', { 'dependencies': ['../build/linux/system.gyp:gtk'], }], + ['OS != "ios"', { + 'dependencies': [ + '../components/nacl_common.gypi:nacl_switches', + ], + }], ], }, ], @@ -96,6 +101,7 @@ ], 'dependencies': [ '../base/base.gyp:base_nacl_win64', + '../components/nacl_common.gypi:nacl_switches_win64', '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'defines': [ diff --git a/chrome/nacl/DEPS b/chrome/nacl/DEPS index a3d7040..c5a003d 100644 --- a/chrome/nacl/DEPS +++ b/chrome/nacl/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+chrome/app/breakpad_win.h", + "+components/nacl", "+content/public/app/startup_helper_win.h", "+sandbox/linux/seccomp-bpf", "+sandbox/linux/services", diff --git a/chrome/nacl/nacl_broker_listener.cc b/chrome/nacl/nacl_broker_listener.cc index e310dfe..1a49a1f 100644 --- a/chrome/nacl/nacl_broker_listener.cc +++ b/chrome/nacl/nacl_broker_listener.cc @@ -15,6 +15,8 @@ #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_debug_exception_handler_win.h" #include "chrome/common/nacl_messages.h" +#include "components/nacl/common/nacl_switches.h" +#include "content/public/common/content_switches.h" #include "content/public/common/sandbox_init.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_switches.h" diff --git a/chrome/nacl/nacl_exe_win_64.cc b/chrome/nacl/nacl_exe_win_64.cc index 7ba3c40..5201315 100644 --- a/chrome/nacl/nacl_exe_win_64.cc +++ b/chrome/nacl/nacl_exe_win_64.cc @@ -12,12 +12,13 @@ #include "base/strings/string_util.h" #include "chrome/app/breakpad_win.h" #include "chrome/common/chrome_result_codes.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "chrome/nacl/nacl_broker_listener.h" #include "chrome/nacl/nacl_listener.h" #include "chrome/nacl/nacl_main_platform_delegate.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/app/startup_helper_win.h" +#include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/sandbox_init.h" #include "sandbox/win/src/sandbox_types.h" diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc index 112a9c4..21b4aa3 100644 --- a/chrome/nacl/nacl_main.cc +++ b/chrome/nacl/nacl_main.cc @@ -13,6 +13,7 @@ #include "chrome/common/logging_chrome.h" #include "chrome/nacl/nacl_listener.h" #include "chrome/nacl/nacl_main_platform_delegate.h" +#include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" // main() routine for the NaCl loader process. diff --git a/chrome/nacl/nacl_main_platform_delegate_mac.mm b/chrome/nacl/nacl_main_platform_delegate_mac.mm index e304ea7..2b094b1 100644 --- a/chrome/nacl/nacl_main_platform_delegate_mac.mm +++ b/chrome/nacl/nacl_main_platform_delegate_mac.mm @@ -10,7 +10,7 @@ #include "base/logging.h" #include "base/native_library.h" #include "chrome/common/chrome_sandbox_type_mac.h" -#include "chrome/common/chrome_switches.h" +#include "components/nacl/common/nacl_switches.h" #include "content/public/common/sandbox_init.h" NaClMainPlatformDelegate::NaClMainPlatformDelegate( diff --git a/chrome/nacl/nacl_main_platform_delegate_win.cc b/chrome/nacl/nacl_main_platform_delegate_win.cc index abd9b3e..be37857 100644 --- a/chrome/nacl/nacl_main_platform_delegate_win.cc +++ b/chrome/nacl/nacl_main_platform_delegate_win.cc @@ -8,7 +8,7 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/native_library.h" -#include "chrome/common/chrome_switches.h" +#include "components/nacl/common/nacl_switches.h" #include "sandbox/win/src/sandbox.h" NaClMainPlatformDelegate::NaClMainPlatformDelegate( diff --git a/components/nacl/OWNERS b/components/nacl/OWNERS new file mode 100644 index 0000000..8345057 --- /dev/null +++ b/components/nacl/OWNERS @@ -0,0 +1,6 @@ +bradchen@chromium.org +bradnelson@chromium.org +jvoung@chromium.org +mseaborn@chromium.org +noelallen@chromium.org +sehr@chromium.org diff --git a/components/nacl/common/nacl_switches.cc b/components/nacl/common/nacl_switches.cc new file mode 100644 index 0000000..d2a01d5 --- /dev/null +++ b/components/nacl/common/nacl_switches.cc @@ -0,0 +1,39 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/nacl/common/nacl_switches.h" + +namespace switches { + +// Causes the process to run as a NativeClient broker +// (used for launching NaCl loader processes on 64-bit Windows). +const char kNaClBrokerProcess[] = "nacl-broker"; + +// Uses NaCl manifest URL to choose whether NaCl program will be debugged by +// debug stub. +// Switch value format: [!]pattern1,pattern2,...,patternN. Each pattern uses +// the same syntax as patterns in Chrome extension manifest. The only difference +// is that * scheme matches all schemes instead of matching only http and https. +// If the value doesn't start with !, a program will be debugged if manifest URL +// matches any pattern. If the value starts with !, a program will be debugged +// if manifest URL does not match any pattern. +const char kNaClDebugMask[] = "nacl-debug-mask"; + +// Native Client GDB debugger that will be launched automatically when needed. +const char kNaClGdb[] = "nacl-gdb"; + +// GDB script to pass to the nacl-gdb debugger at startup. +const char kNaClGdbScript[] = "nacl-gdb-script"; + +// On POSIX only: the contents of this flag are prepended to the nacl-loader +// command line. Useful values might be "valgrind" or "xterm -e gdb --args". +const char kNaClLoaderCmdPrefix[] = "nacl-loader-cmd-prefix"; + +// Causes the process to run as a NativeClient loader. +const char kNaClLoaderProcess[] = "nacl-loader"; + +// Runs the security test for the NaCl loader sandbox. +const char kTestNaClSandbox[] = "test-nacl-sandbox"; + +} // namespace switches diff --git a/components/nacl/common/nacl_switches.h b/components/nacl/common/nacl_switches.h new file mode 100644 index 0000000..132ac7a --- /dev/null +++ b/components/nacl/common/nacl_switches.h @@ -0,0 +1,24 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Defines all the command-line switches used by Chrome. + +#ifndef COMPONENTS_NACL_COMMON_NACL_SWITCHES_H_ +#define COMPONENTS_NACL_COMMON_NACL_SWITCHES_H_ + +namespace switches { + +// All switches in alphabetical order. The switches should be documented +// alongside the definition of their values in the .cc file. +extern const char kNaClBrokerProcess[]; +extern const char kNaClDebugMask[]; +extern const char kNaClGdb[]; +extern const char kNaClGdbScript[]; +extern const char kNaClLoaderCmdPrefix[]; +extern const char kNaClLoaderProcess[]; +extern const char kTestNaClSandbox[]; + +} // namespace switches + +#endif // COMPONENTS_NACL_COMMON_NACL_SWITCHES_H_ diff --git a/components/nacl_common.gypi b/components/nacl_common.gypi new file mode 100644 index 0000000..00137c5 --- /dev/null +++ b/components/nacl_common.gypi @@ -0,0 +1,41 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'nacl_switches', + 'type': 'static_library', + 'sources': [ + 'nacl/common/nacl_switches.cc', + 'nacl/common/nacl_switches.h', + ], + 'include_dirs': [ + '..', + ], + }, + ], + 'conditions': [ + ['OS=="win" and target_arch=="ia32"', { + 'targets': [ + { + 'target_name': 'nacl_switches_win64', + 'type': 'static_library', + 'sources': [ + 'nacl/common/nacl_switches.cc', + 'nacl/common/nacl_switches.h', + ], + 'include_dirs': [ + '..', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, + }, + ], + }], + ], +} |