diff options
author | avi <avi@chromium.org> | 2014-12-25 09:48:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-25 17:48:57 +0000 |
commit | 79bf913a9f95ff7249018d0e5179f61608cfb82b (patch) | |
tree | 02c8ababb843df5cdd00e4f8911e052486d256b3 /chrome/installer | |
parent | c28b45c1f969a9da103062adb6b8d9789193ddb3 (diff) | |
download | chromium_src-79bf913a9f95ff7249018d0e5179f61608cfb82b.zip chromium_src-79bf913a9f95ff7249018d0e5179f61608cfb82b.tar.gz chromium_src-79bf913a9f95ff7249018d0e5179f61608cfb82b.tar.bz2 |
Make callers of CommandLine use it via the base:: namespace, and remove the global alias.
BUG=422426
TEST=none
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/812353003
Cr-Commit-Position: refs/heads/master@{#309644}
Diffstat (limited to 'chrome/installer')
34 files changed, 203 insertions, 188 deletions
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index f08d90f..ef3c963 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc @@ -504,7 +504,7 @@ BOOL __stdcall LaunchGoogleChrome() { } } - CommandLine chrome_command(chrome_exe_path); + base::CommandLine chrome_command(chrome_exe_path); bool ret = false; ScopedComPtr<IProcessLauncher> ipl; @@ -540,7 +540,7 @@ BOOL __stdcall LaunchGoogleChromeWithDimensions(int x, // When launching in the background, use WMI to ensure that chrome.exe is // is not our child process. This prevents it from pushing itself to // foreground. - CommandLine chrome_command(chrome_exe_path); + base::CommandLine chrome_command(chrome_exe_path); ScopedCOMInitializer com_initializer; if (!installer::WMIProcess::Launch(chrome_command.GetCommandLineString(), diff --git a/chrome/installer/gcapi/gcapi_dll.cc b/chrome/installer/gcapi/gcapi_dll.cc index cb512e4..66e9bc1 100644 --- a/chrome/installer/gcapi/gcapi_dll.cc +++ b/chrome/installer/gcapi/gcapi_dll.cc @@ -21,12 +21,12 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, LPVOID reserved) { if (reason == DLL_PROCESS_ATTACH) { g_exit_manager = new base::AtExitManager(); - CommandLine::Init(0, NULL); + base::CommandLine::Init(0, NULL); logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; logging::InitLogging(settings); } else if (reason == DLL_PROCESS_DETACH) { - CommandLine::Reset(); + base::CommandLine::Reset(); delete g_exit_manager; g_exit_manager = NULL; } diff --git a/chrome/installer/gcapi/gcapi_test.cc b/chrome/installer/gcapi/gcapi_test.cc index 4e5d0a7..be649f0 100644 --- a/chrome/installer/gcapi/gcapi_test.cc +++ b/chrome/installer/gcapi/gcapi_test.cc @@ -62,12 +62,12 @@ const char kManualLaunchTests[] = "launch-chrome"; int main(int argc, char* argv[]) { base::AtExitManager exit_manager; - CommandLine::Init(argc, argv); + base::CommandLine::Init(argc, argv); testing::InitGoogleTest(&argc, argv); RUN_ALL_TESTS(); - if (CommandLine::ForCurrentProcess()->HasSwitch(kManualLaunchTests)) { + if (base::CommandLine::ForCurrentProcess()->HasSwitch(kManualLaunchTests)) { call_dynamically(); call_statically(); printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 2b544b6..64af4da 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -221,7 +221,7 @@ void AddCommandWithParameterWorkItems(const InstallerState& installer_state, ->set_log_message("removing " + base::UTF16ToASCII(command_key) + " command"); } else { - CommandLine cmd_line(installer_state.target_path().Append(app)); + base::CommandLine cmd_line(installer_state.target_path().Append(app)); cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); AppCommand cmd(cmd_line.GetCommandLineString()); @@ -297,7 +297,7 @@ void AddFirewallRulesWorkItems(const InstallerState& installer_state, // --verbose-logging if the current installation was launched with // --verbose-logging. |setup_path| and |new_version| are optional only when // the operation is an uninstall. -CommandLine GetGenericQuickEnableCommand( +base::CommandLine GetGenericQuickEnableCommand( const InstallerState& installer_state, const InstallationState& machine_state, const base::FilePath& setup_path, @@ -331,7 +331,7 @@ CommandLine GetGenericQuickEnableCommand( } DCHECK(!binaries_setup_path.empty()); - CommandLine cmd_line(binaries_setup_path); + base::CommandLine cmd_line(binaries_setup_path); cmd_line.AppendSwitch(switches::kMultiInstall); if (installer_state.verbose_logging()) cmd_line.AppendSwitch(switches::kVerboseLogging); @@ -363,10 +363,8 @@ void AddQuickEnableApplicationLauncherWorkItems( GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BINARIES), kCmdQuickEnableApplicationHost)); - CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state, - machine_state, - setup_path, - new_version)); + base::CommandLine cmd_line(GetGenericQuickEnableCommand( + installer_state, machine_state, setup_path, new_version)); // kMultiInstall and kVerboseLogging were processed above. cmd_line.AppendSwitch(switches::kChromeAppLauncher); cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent); @@ -688,7 +686,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, installer_state.GetInstallerDirectory(new_version)); installer_path = installer_path.Append(setup_path.BaseName()); - CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); + base::CommandLine uninstall_arguments(base::CommandLine::NO_PROGRAM); AppendUninstallCommandLineFlags(installer_state, product, &uninstall_arguments); @@ -712,7 +710,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, // MSI installations will manage their own uninstall shortcuts. if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { // We need to quote the command line for the Add/Remove Programs dialog. - CommandLine quoted_uninstall_cmd(installer_path); + base::CommandLine quoted_uninstall_cmd(installer_path); DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); @@ -1125,7 +1123,7 @@ bool AppendPostInstallTasks(const InstallerState& installer_state, installer_state.GetInstallerDirectory(new_version).Append( setup_path.BaseName())); - CommandLine rename(installer_path); + base::CommandLine rename(installer_path); rename.AppendSwitch(switches::kRenameChromeExe); if (installer_state.system_install()) rename.AppendSwitch(switches::kSystemLevel); @@ -1169,7 +1167,7 @@ bool AppendPostInstallTasks(const InstallerState& installer_state, // The first to run it will perform the operation and clean up the other // values. if (dist->GetType() != BrowserDistribution::CHROME_BINARIES) { - CommandLine product_rename_cmd(rename); + base::CommandLine product_rename_cmd(rename); products[i]->AppendRenameFlags(&product_rename_cmd); in_use_update_work_items->AddSetRegValueWorkItem( root, @@ -1495,7 +1493,7 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( new_version).Append(kActiveSetupExe)); - CommandLine cmd(active_setup_exe); + base::CommandLine cmd(active_setup_exe); cmd.AppendSwitch(installer::switches::kConfigureUserSettings); cmd.AppendSwitch(installer::switches::kVerboseLogging); cmd.AppendSwitch(installer::switches::kSystemLevel); @@ -1544,7 +1542,7 @@ void AddDeleteOldIELowRightsPolicyWorkItems( void AppendUninstallCommandLineFlags(const InstallerState& installer_state, const Product& product, - CommandLine* uninstall_cmd) { + base::CommandLine* uninstall_cmd) { DCHECK(uninstall_cmd); uninstall_cmd->AppendSwitch(installer::switches::kUninstall); @@ -1596,9 +1594,9 @@ void AddOsUpgradeWorkItems(const InstallerState& installer_state, } else { // Register with Google Update to have setup.exe --on-os-upgrade called on // OS upgrade. - CommandLine cmd_line(installer_state - .GetInstallerDirectory(new_version) - .Append(setup_path.BaseName())); + base::CommandLine cmd_line( + installer_state.GetInstallerDirectory(new_version) + .Append(setup_path.BaseName())); // Add the main option to indicate OS upgrade flow. cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); // Add product-specific options. @@ -1626,9 +1624,9 @@ void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state, work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY) ->set_log_message("Removing query EULA acceptance command"); } else { - CommandLine cmd_line(installer_state - .GetInstallerDirectory(new_version) - .Append(setup_path.BaseName())); + base::CommandLine cmd_line( + installer_state.GetInstallerDirectory(new_version) + .Append(setup_path.BaseName())); cmd_line.AppendSwitch(switches::kQueryEULAAcceptance); if (installer_state.system_install()) cmd_line.AppendSwitch(installer::switches::kSystemLevel); diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index 29260b2..c288549 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc @@ -119,7 +119,7 @@ class MockProductState : public ProductState { } void clear_oem_install() { has_oem_install_ = false; } void SetUninstallProgram(const base::FilePath& setup_exe) { - uninstall_command_ = CommandLine(setup_exe); + uninstall_command_ = base::CommandLine(setup_exe); } void AddUninstallSwitch(const std::string& option) { uninstall_command_.AppendSwitch(option); diff --git a/chrome/installer/setup/run_all_unittests.cc b/chrome/installer/setup/run_all_unittests.cc index a309b11..fa35408 100644 --- a/chrome/installer/setup/run_all_unittests.cc +++ b/chrome/installer/setup/run_all_unittests.cc @@ -12,7 +12,7 @@ int main(int argc, char** argv) { // Handle the --adjust-process-priority switch, which is used to test the // installer::AdjustProcessPriority() function in a subprocess. - if (CommandLine::ForCurrentProcess()->HasSwitch(kAdjustProcessPriority)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch(kAdjustProcessPriority)) return DoProcessPriorityAdjustment(); // Register Chrome Path provider so that we can get test data dir. diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index ce590b0..9017b33 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -91,7 +91,7 @@ namespace { // returns a patch helper configured to uncompress and patch. scoped_ptr<installer::ArchivePatchHelper> CreateChromeArchiveHelper( const base::FilePath& setup_exe, - const CommandLine& command_line, + const base::CommandLine& command_line, const installer::InstallerState& installer_state, const base::FilePath& working_directory) { // A compressed archive is ordinarily given on the command line by the mini @@ -583,7 +583,7 @@ bool CheckPreInstallConditions(const InstallationState& original_state, *status = installer::EXISTING_VERSION_LAUNCHED; base::FilePath chrome_exe = install_path.Append(installer::kChromeExe); - CommandLine cmd(chrome_exe); + base::CommandLine cmd(chrome_exe); cmd.AppendSwitch(switches::kForceFirstRun); installer_state->WriteInstallerResult(*status, 0, NULL); VLOG(1) << "Launching existing system-level chrome instead."; @@ -644,7 +644,7 @@ installer::InstallStatus UninstallProduct( const InstallationState& original_state, const InstallerState& installer_state, const base::FilePath& setup_exe, - const CommandLine& cmd_line, + const base::CommandLine& cmd_line, bool remove_all, bool force_uninstall, const Product& product) { @@ -669,12 +669,12 @@ installer::InstallStatus UninstallProducts( const InstallationState& original_state, const InstallerState& installer_state, const base::FilePath& setup_exe, - const CommandLine& cmd_line) { + const base::CommandLine& cmd_line) { const Products& products = installer_state.products(); // System-level Chrome will be launched via this command if its program gets // set below. - CommandLine system_level_cmd(CommandLine::NO_PROGRAM); + base::CommandLine system_level_cmd(base::CommandLine::NO_PROGRAM); const Product* chrome = installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); @@ -758,7 +758,7 @@ void UninstallBinariesIfUnused( const ProductState* binaries_state = original_state.GetProductState(installer_state.system_install(), BrowserDistribution::CHROME_BINARIES); - const CommandLine& uninstall_cmd(binaries_state->uninstall_command()); + const base::CommandLine& uninstall_cmd(binaries_state->uninstall_command()); MasterPreferences uninstall_prefs(uninstall_cmd); InstallerState uninstall_state; uninstall_state.Initialize(uninstall_cmd, uninstall_prefs, original_state); @@ -778,7 +778,7 @@ void UninstallBinariesIfUnused( installer::InstallStatus InstallProducts( const InstallationState& original_state, const base::FilePath& setup_exe, - const CommandLine& cmd_line, + const base::CommandLine& cmd_line, const MasterPreferences& prefs, InstallerState* installer_state, base::FilePath* installer_directory) { @@ -895,7 +895,7 @@ installer::InstallStatus RegisterDevChrome( const InstallationState& original_state, const InstallerState& installer_state, const base::FilePath& setup_exe, - const CommandLine& cmd_line) { + const base::CommandLine& cmd_line) { BrowserDistribution* chrome_dist = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER); @@ -971,7 +971,7 @@ installer::InstallStatus RegisterDevChrome( // has been found and processed (so setup.exe should exit at that point). bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, const base::FilePath& setup_exe, - const CommandLine& cmd_line, + const base::CommandLine& cmd_line, InstallerState* installer_state, int* exit_code) { // TODO(gab): Add a local |status| variable which each block below sets; @@ -1325,7 +1325,7 @@ scoped_ptr<google_breakpad::ExceptionHandler> InitializeCrashReporting( // binaries will be uninstalled during later processing if they are not in-use // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are // updated to reflect the state of the world following the operation. -void UninstallMultiChromeFrameIfPresent(const CommandLine& cmd_line, +void UninstallMultiChromeFrameIfPresent(const base::CommandLine& cmd_line, const MasterPreferences& prefs, InstallationState* original_state, InstallerState* installer_state) { @@ -1347,7 +1347,8 @@ void UninstallMultiChromeFrameIfPresent(const CommandLine& cmd_line, // Uninstall Chrome Frame without touching the multi-install binaries. // Simulate the uninstall as coming from the installed version. - const CommandLine& uninstall_cmd(chrome_frame_state->uninstall_command()); + const base::CommandLine& uninstall_cmd( + chrome_frame_state->uninstall_command()); MasterPreferences uninstall_prefs(uninstall_cmd); InstallerState uninstall_state; uninstall_state.Initialize(uninstall_cmd, uninstall_prefs, *original_state); @@ -1381,15 +1382,14 @@ void UninstallMultiChromeFrameIfPresent(const CommandLine& cmd_line, namespace installer { -InstallStatus InstallProductsHelper( - const InstallationState& original_state, - const base::FilePath& setup_exe, - const CommandLine& cmd_line, - const MasterPreferences& prefs, - const InstallerState& installer_state, - base::FilePath* installer_directory, - ArchiveType* archive_type, - bool* delegated_to_existing) { +InstallStatus InstallProductsHelper(const InstallationState& original_state, + const base::FilePath& setup_exe, + const base::CommandLine& cmd_line, + const MasterPreferences& prefs, + const InstallerState& installer_state, + base::FilePath* installer_directory, + ArchiveType* archive_type, + bool* delegated_to_existing) { DCHECK(archive_type); DCHECK(delegated_to_existing); const bool system_install = installer_state.system_install(); @@ -1683,7 +1683,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, // The exit manager is in charge of calling the dtors of singletons. base::AtExitManager exit_manager; - CommandLine::Init(0, NULL); + base::CommandLine::Init(0, NULL); // install_util uses chrome paths. chrome::RegisterPathProvider(); @@ -1691,7 +1691,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, const MasterPreferences& prefs = MasterPreferences::ForCurrentProcess(); installer::InitInstallerLogging(prefs); - const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); + const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); VLOG(1) << "multi install is " << prefs.is_multi_install(); @@ -1764,7 +1764,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, if (system_install && !IsUserAnAdmin()) { if (base::win::GetVersion() >= base::win::VERSION_VISTA && !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { - CommandLine new_cmd(CommandLine::NO_PROGRAM); + base::CommandLine new_cmd(base::CommandLine::NO_PROGRAM); new_cmd.AppendArguments(cmd_line, true); // Append --run-as-admin flag to let the new instance of setup.exe know // that we already tried to launch ourselves as admin. diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index d671097..ba25f7e 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -45,15 +45,15 @@ namespace { // the off chance that waiting itself fails, |exit_code| is set to // WAIT_FOR_EXISTING_FAILED. bool LaunchAndWaitForExistingInstall(const base::FilePath& setup_exe, - const CommandLine& command_line, + const base::CommandLine& command_line, int* exit_code) { DCHECK(exit_code); - CommandLine new_cl(setup_exe); + base::CommandLine new_cl(setup_exe); // Copy over all switches but --install-archive. - CommandLine::SwitchMap switches(command_line.GetSwitches()); + base::CommandLine::SwitchMap switches(command_line.GetSwitches()); switches.erase(switches::kInstallArchive); - for (CommandLine::SwitchMap::const_iterator i = switches.begin(); + for (base::CommandLine::SwitchMap::const_iterator i = switches.begin(); i != switches.end(); ++i) { if (i->second.empty()) new_cl.AppendSwitch(i->first); @@ -62,8 +62,8 @@ bool LaunchAndWaitForExistingInstall(const base::FilePath& setup_exe, } // Copy over all arguments. - CommandLine::StringVector args(command_line.GetArgs()); - for (CommandLine::StringVector::const_iterator i = args.begin(); + base::CommandLine::StringVector args(command_line.GetArgs()); + for (base::CommandLine::StringVector::const_iterator i = args.begin(); i != args.end(); ++i) { new_cl.AppendArgNative(*i); } @@ -285,7 +285,7 @@ bool GetExistingHigherInstaller( } bool DeferToExistingInstall(const base::FilePath& setup_exe, - const CommandLine& command_line, + const base::CommandLine& command_line, const InstallerState& installer_state, const base::FilePath& temp_path, InstallStatus* install_status) { @@ -432,7 +432,7 @@ bool IsUninstallSuccess(InstallStatus install_status) { install_status == UNINSTALL_REQUIRES_REBOOT); } -bool ContainsUnsupportedSwitch(const CommandLine& cmd_line) { +bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line) { static const char* const kLegacySwitches[] = { // Chrome Frame ready-mode. "ready-mode", diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index e11f33a..c07ec98 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -229,7 +229,7 @@ ScopedPriorityClass::~ScopedPriorityClass() { } PriorityClassChangeResult RelaunchAndDoProcessPriorityAdjustment() { - CommandLine cmd_line(*CommandLine::ForCurrentProcess()); + base::CommandLine cmd_line(*base::CommandLine::ForCurrentProcess()); cmd_line.AppendSwitch(kAdjustProcessPriority); base::Process process = base::LaunchProcess(cmd_line, base::LaunchOptions()); int exit_code = 0; @@ -285,7 +285,7 @@ class FindArchiveToPatchTest : public SetupUtilTestWithDir { version_.reset(); } - void set_uninstall_command(const CommandLine& uninstall_command) { + void set_uninstall_command(const base::CommandLine& uninstall_command) { uninstall_command_ = uninstall_command; } }; @@ -342,10 +342,11 @@ class FindArchiveToPatchTest : public SetupUtilTestWithDir { kProductType_)); product->set_version(product_version_); - CommandLine uninstall_command( - test_dir_.path().AppendASCII(product_version_.GetString()) - .Append(installer::kInstallerDir) - .Append(installer::kSetupExe)); + base::CommandLine uninstall_command( + test_dir_.path() + .AppendASCII(product_version_.GetString()) + .Append(installer::kInstallerDir) + .Append(installer::kSetupExe)); uninstall_command.AppendSwitch(installer::switches::kUninstall); product->set_uninstall_command(uninstall_command); } @@ -490,11 +491,11 @@ TEST_F(MigrateMultiToSingleTest, ChromeFrame) { TEST(SetupUtilTest, ContainsUnsupportedSwitch) { EXPECT_FALSE(installer::ContainsUnsupportedSwitch( - CommandLine::FromString(L"foo.exe"))); + base::CommandLine::FromString(L"foo.exe"))); EXPECT_FALSE(installer::ContainsUnsupportedSwitch( - CommandLine::FromString(L"foo.exe --multi-install --chrome"))); + base::CommandLine::FromString(L"foo.exe --multi-install --chrome"))); EXPECT_TRUE(installer::ContainsUnsupportedSwitch( - CommandLine::FromString(L"foo.exe --chrome-frame"))); + base::CommandLine::FromString(L"foo.exe --chrome-frame"))); } TEST(SetupUtilTest, GetRegistrationDataCommandKey) { diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 0eb961a..3df4ea8 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -607,7 +607,7 @@ InstallStatus IsChromeActiveOrUserCancelled( const InstallerState& installer_state, const Product& product) { int32 exit_code = content::RESULT_CODE_NORMAL_EXIT; - CommandLine options(CommandLine::NO_PROGRAM); + base::CommandLine options(base::CommandLine::NO_PROGRAM); options.AppendSwitch(installer::switches::kUninstall); // Here we want to save user from frustration (in case of Chrome crashes) @@ -638,7 +638,8 @@ InstallStatus IsChromeActiveOrUserCancelled( } bool ShouldDeleteProfile(const InstallerState& installer_state, - const CommandLine& cmd_line, InstallStatus status, + const base::CommandLine& cmd_line, + InstallStatus status, const Product& product) { bool should_delete = false; @@ -1094,7 +1095,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, const Product& product, bool remove_all, bool force_uninstall, - const CommandLine& cmd_line) { + const base::CommandLine& cmd_line) { InstallStatus status = installer::UNINSTALL_CONFIRMED; BrowserDistribution* browser_dist = product.distribution(); const base::FilePath chrome_exe( @@ -1132,7 +1133,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, !::IsUserAnAdmin() && base::win::GetVersion() >= base::win::VERSION_VISTA && !cmd_line.HasSwitch(installer::switches::kRunAsAdmin)) { - CommandLine new_cmd(CommandLine::NO_PROGRAM); + base::CommandLine new_cmd(base::CommandLine::NO_PROGRAM); new_cmd.AppendArguments(cmd_line, true); // Append --run-as-admin flag to let the new instance of setup.exe know // that we already tried to launch ourselves as admin. diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index fd66c01..98c72cf 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -467,7 +467,7 @@ bool ApplyAlternateVersion(const base::FilePath& work_dir, // command-line switch. base::FilePath Get7zaPath() { base::FilePath l7za_path = - CommandLine::ForCurrentProcess()->GetSwitchValuePath( + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( &kSwitch7zaPath[0]); if (l7za_path.empty()) { base::FilePath dir_exe; diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 7d819f0..9211a3d 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc @@ -58,7 +58,7 @@ const wchar_t* GetErrorMessage(ErrorCode error_code) { // Display usage information to stderr along with an optional error message with // details. -void DumpUsage(const CommandLine& cmd_line, +void DumpUsage(const base::CommandLine& cmd_line, errors::ErrorCode error_code, const std::wstring& detail) { const wchar_t* error_message = errors::GetErrorMessage(error_code); @@ -93,7 +93,7 @@ L" relative to this program's location.\n", // Gets the path to the source mini_installer.exe on which to operate, putting // the result in |mini_installer|. Returns true on success. -bool GetMiniInstallerPath(const CommandLine& cmd_line, +bool GetMiniInstallerPath(const base::CommandLine& cmd_line, base::FilePath* mini_installer) { DCHECK(mini_installer); base::FilePath result = cmd_line.GetSwitchValuePath(switches::kMiniInstaller); @@ -106,7 +106,7 @@ bool GetMiniInstallerPath(const CommandLine& cmd_line, } // Gets the path to the output file, putting the result in |out|. -void GetOutPath(const CommandLine& cmd_line, base::FilePath* out) { +void GetOutPath(const base::CommandLine& cmd_line, base::FilePath* out) { DCHECK(out); base::FilePath result = cmd_line.GetSwitchValuePath(switches::kOut); if (result.empty()) @@ -116,7 +116,7 @@ void GetOutPath(const CommandLine& cmd_line, base::FilePath* out) { } // Returns the direction in which the version should be adjusted. -upgrade_test::Direction GetDirection(const CommandLine& cmd_line) { +upgrade_test::Direction GetDirection(const base::CommandLine& cmd_line) { return cmd_line.HasSwitch(switches::kPrevious) ? upgrade_test::PREVIOUS_VERSION : upgrade_test::NEXT_VERSION; } @@ -126,8 +126,8 @@ upgrade_test::Direction GetDirection(const CommandLine& cmd_line) { // The main program. int wmain(int argc, wchar_t *argv[]) { base::AtExitManager exit_manager; - CommandLine::Init(0, NULL); - CommandLine* cmd_line = CommandLine::ForCurrentProcess(); + base::CommandLine::Init(0, NULL); + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); if (cmd_line->HasSwitch(switches::kHelp)) { DumpUsage(*cmd_line, errors::SHOW_HELP, std::wstring()); diff --git a/chrome/installer/tools/validate_installation_main.cc b/chrome/installer/tools/validate_installation_main.cc index dc95aaa..74f860c 100644 --- a/chrome/installer/tools/validate_installation_main.cc +++ b/chrome/installer/tools/validate_installation_main.cc @@ -165,7 +165,7 @@ int wmain(int argc, wchar_t *argv[]) { int result = EXIT_SUCCESS; base::AtExitManager exit_manager; - CommandLine::Init(0, NULL); + base::CommandLine::Init(0, NULL); ConsoleLogHelper log_helper; // Check user-level and system-level for products. diff --git a/chrome/installer/util/auto_launch_util.cc b/chrome/installer/util/auto_launch_util.cc index 9ab226d6..08be65d 100644 --- a/chrome/installer/util/auto_launch_util.cc +++ b/chrome/installer/util/auto_launch_util.cc @@ -183,7 +183,8 @@ void SetWillLaunchAtLogin(const base::FilePath& application_path, cmd_line += ASCIIToUTF16(" --"); cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup); - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kUserDataDir)) { cmd_line += ASCIIToUTF16(" --"); cmd_line += ASCIIToUTF16(switches::kUserDataDir); diff --git a/chrome/installer/util/chrome_app_host_operations.cc b/chrome/installer/util/chrome_app_host_operations.cc index 79cfe6b..6130d41 100644 --- a/chrome/installer/util/chrome_app_host_operations.cc +++ b/chrome/installer/util/chrome_app_host_operations.cc @@ -30,9 +30,9 @@ void ChromeAppHostOperations::ReadOptions(const MasterPreferences& prefs, } } -void ChromeAppHostOperations::ReadOptions(const CommandLine& uninstall_command, - std::set<base::string16>* options) - const { +void ChromeAppHostOperations::ReadOptions( + const base::CommandLine& uninstall_command, + std::set<base::string16>* options) const { DCHECK(options); if (uninstall_command.HasSwitch(switches::kMultiInstall)) @@ -51,7 +51,7 @@ void ChromeAppHostOperations::AddComDllList( void ChromeAppHostOperations::AppendProductFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); @@ -68,7 +68,7 @@ void ChromeAppHostOperations::AppendProductFlags( void ChromeAppHostOperations::AppendRenameFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); @@ -105,7 +105,7 @@ void ChromeAppHostOperations::AddDefaultShortcutProperties( properties->set_target(target_exe); if (!properties->has_arguments()) { - CommandLine app_host_args(CommandLine::NO_PROGRAM); + base::CommandLine app_host_args(base::CommandLine::NO_PROGRAM); app_host_args.AppendSwitch(::switches::kShowAppList); properties->set_arguments(app_host_args.GetCommandLineString()); } diff --git a/chrome/installer/util/chrome_binaries_operations.cc b/chrome/installer/util/chrome_binaries_operations.cc index 85ba7bf..f8fc1ff 100644 --- a/chrome/installer/util/chrome_binaries_operations.cc +++ b/chrome/installer/util/chrome_binaries_operations.cc @@ -22,9 +22,9 @@ void ChromeBinariesOperations::ReadOptions(const MasterPreferences& prefs, options->insert(kOptionMultiInstall); } -void ChromeBinariesOperations::ReadOptions(const CommandLine& uninstall_command, - std::set<base::string16>* options) - const { +void ChromeBinariesOperations::ReadOptions( + const base::CommandLine& uninstall_command, + std::set<base::string16>* options) const { DCHECK(options); options->insert(kOptionMultiInstall); } @@ -43,7 +43,7 @@ void ChromeBinariesOperations::AddComDllList( void ChromeBinariesOperations::AppendProductFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); DCHECK(options.find(kOptionMultiInstall) != options.end()); @@ -55,7 +55,7 @@ void ChromeBinariesOperations::AppendProductFlags( void ChromeBinariesOperations::AppendRenameFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); DCHECK(options.find(kOptionMultiInstall) != options.end()); diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 1b7bd00..431b2e1 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc @@ -34,9 +34,9 @@ void ChromeBrowserOperations::ReadOptions(const MasterPreferences& prefs, } } -void ChromeBrowserOperations::ReadOptions(const CommandLine& uninstall_command, - std::set<base::string16>* options) - const { +void ChromeBrowserOperations::ReadOptions( + const base::CommandLine& uninstall_command, + std::set<base::string16>* options) const { DCHECK(options); if (uninstall_command.HasSwitch(switches::kMultiInstall)) @@ -57,7 +57,7 @@ void ChromeBrowserOperations::AddComDllList( void ChromeBrowserOperations::AppendProductFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); if (options.find(kOptionMultiInstall) != options.end()) { @@ -72,7 +72,7 @@ void ChromeBrowserOperations::AppendProductFlags( void ChromeBrowserOperations::AppendRenameFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); // Add --multi-install if it isn't already there. @@ -142,7 +142,7 @@ void ChromeBrowserOperations::LaunchUserExperiment( const std::set<base::string16>& options, InstallStatus status, bool system_level) const { - CommandLine base_command(setup_path); + base::CommandLine base_command(setup_path); AppendProductFlags(options, &base_command); installer::LaunchBrowserUserExperiment(base_command, status, system_level); } diff --git a/chrome/installer/util/chrome_browser_sxs_operations.cc b/chrome/installer/util/chrome_browser_sxs_operations.cc index ef2fe68..71798c3 100644 --- a/chrome/installer/util/chrome_browser_sxs_operations.cc +++ b/chrome/installer/util/chrome_browser_sxs_operations.cc @@ -12,7 +12,7 @@ namespace installer { void ChromeBrowserSxSOperations::AppendProductFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); cmd_line->AppendSwitch(switches::kChromeSxS); @@ -21,7 +21,7 @@ void ChromeBrowserSxSOperations::AppendProductFlags( void ChromeBrowserSxSOperations::AppendRenameFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); cmd_line->AppendSwitch(switches::kChromeSxS); diff --git a/chrome/installer/util/chrome_frame_operations.cc b/chrome/installer/util/chrome_frame_operations.cc index 278310b..6ed2edc 100644 --- a/chrome/installer/util/chrome_frame_operations.cc +++ b/chrome/installer/util/chrome_frame_operations.cc @@ -36,9 +36,9 @@ void ChromeFrameOperations::ReadOptions(const MasterPreferences& prefs, } } -void ChromeFrameOperations::ReadOptions(const CommandLine& uninstall_command, - std::set<base::string16>* options) - const { +void ChromeFrameOperations::ReadOptions( + const base::CommandLine& uninstall_command, + std::set<base::string16>* options) const { DCHECK(options); static const struct FlagToOption { @@ -72,7 +72,7 @@ void ChromeFrameOperations::AddComDllList( void ChromeFrameOperations::AppendProductFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); @@ -86,7 +86,7 @@ void ChromeFrameOperations::AppendProductFlags( void ChromeFrameOperations::AppendRenameFlags( const std::set<base::string16>& options, - CommandLine* cmd_line) const { + base::CommandLine* cmd_line) const { DCHECK(cmd_line); bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc index 05c3ecc..5140146 100644 --- a/chrome/installer/util/google_update_util.cc +++ b/chrome/installer/util/google_update_util.cc @@ -66,7 +66,7 @@ bool GetUserLevelGoogleUpdateInstallCommandLine(base::string16* cmd_string) { base::FilePath google_update_setup( GetGoogleUpdateSetupExe(true)); // system-level. if (!google_update_setup.empty()) { - CommandLine cmd(google_update_setup); + base::CommandLine cmd(google_update_setup); // Appends "/install runtime=true&needsadmin=false /silent /nomitag". // NB: /nomitag needs to be at the end. // Constants are found in code.google.com/p/omaha/common/const_cmd_line.h. @@ -164,7 +164,7 @@ void ElevateIfNeededToReenableUpdates() { return; } - CommandLine cmd(exe_path); + base::CommandLine cmd(exe_path); cmd.AppendSwitch(installer::switches::kReenableAutoupdates); installer::Product product(dist); product.InitializeFromUninstallCommand(product_state.uninstall_command()); diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index e81c0cc..7a11c81 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -148,7 +148,7 @@ void InstallUtil::TriggerActiveSetupCommand() { return; } - CommandLine cmd(CommandLine::FromString(cmd_str)); + base::CommandLine cmd(base::CommandLine::FromString(cmd_str)); // Force creation of shortcuts as the First Run beacon might land between now // and the time setup.exe checks for it. cmd.AppendSwitch(installer::switches::kForceConfigureUserSettings); @@ -162,12 +162,13 @@ void InstallUtil::TriggerActiveSetupCommand() { PLOG(ERROR) << cmd.GetCommandLineString(); } -bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) { +bool InstallUtil::ExecuteExeAsAdmin(const base::CommandLine& cmd, + DWORD* exit_code) { base::FilePath::StringType program(cmd.GetProgram().value()); DCHECK(!program.empty()); DCHECK_NE(program[0], L'\"'); - CommandLine::StringType params(cmd.GetCommandLineString()); + base::CommandLine::StringType params(cmd.GetCommandLineString()); if (params[0] == '"') { DCHECK_EQ('"', params[program.length() + 1]); DCHECK_EQ(program, params.substr(1, program.length())); @@ -208,13 +209,14 @@ bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) { return success; } -CommandLine InstallUtil::GetChromeUninstallCmd( - bool system_install, BrowserDistribution::Type distribution_type) { +base::CommandLine InstallUtil::GetChromeUninstallCmd( + bool system_install, + BrowserDistribution::Type distribution_type) { ProductState state; if (state.Initialize(system_install, distribution_type)) { return state.uninstall_command(); } - return CommandLine(CommandLine::NO_PROGRAM); + return base::CommandLine(base::CommandLine::NO_PROGRAM); } void InstallUtil::GetChromeVersion(BrowserDistribution* dist, @@ -388,7 +390,7 @@ bool InstallUtil::IsMultiInstall(BrowserDistribution* dist, } bool CheckIsChromeSxSProcess() { - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); CHECK(command_line); if (command_line->HasSwitch(installer::switches::kChromeSxS)) @@ -564,8 +566,9 @@ int InstallUtil::GetInstallReturnCode(installer::InstallStatus status) { // static void InstallUtil::MakeUninstallCommand(const base::string16& program, const base::string16& arguments, - CommandLine* command_line) { - *command_line = CommandLine::FromString(L"\"" + program + L"\" " + arguments); + base::CommandLine* command_line) { + *command_line = + base::CommandLine::FromString(L"\"" + program + L"\" " + arguments); } // static @@ -623,7 +626,7 @@ bool InstallUtil::ProgramCompare::Evaluate(const base::string16& value) const { // Suss out the exe portion of the value, which is expected to be a command // line kinda (or exactly) like: // "c:\foo\bar\chrome.exe" -- "%1" - base::FilePath program(CommandLine::FromString(value).GetProgram()); + base::FilePath program(base::CommandLine::FromString(value).GetProgram()); if (program.empty()) { LOG(WARNING) << "Failed to parse an executable name from command line: \"" << value << "\""; diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc index 238148f..22dea39 100644 --- a/chrome/installer/util/install_util_unittest.cc +++ b/chrome/installer/util/install_util_unittest.cc @@ -35,7 +35,7 @@ class InstallUtilTest : public TestWithTempDirAndDeleteTempOverrideKeys { }; TEST_F(InstallUtilTest, MakeUninstallCommand) { - CommandLine command_line(CommandLine::NO_PROGRAM); + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); std::pair<std::wstring, std::wstring> params[] = { std::make_pair(std::wstring(L""), std::wstring(L"")), diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc index 0173581..3c62306 100644 --- a/chrome/installer/util/installation_state.cc +++ b/chrome/installer/util/installation_state.cc @@ -15,7 +15,7 @@ namespace installer { ProductState::ProductState() - : uninstall_command_(CommandLine::NO_PROGRAM), + : uninstall_command_(base::CommandLine::NO_PROGRAM), eula_accepted_(0), usagestats_(0), msi_(false), @@ -181,7 +181,7 @@ void ProductState::Clear() { brand_.clear(); rename_cmd_.clear(); oem_install_.clear(); - uninstall_command_ = CommandLine(CommandLine::NO_PROGRAM); + uninstall_command_ = base::CommandLine(base::CommandLine::NO_PROGRAM); commands_.Clear(); eula_accepted_ = 0; usagestats_ = 0; diff --git a/chrome/installer/util/installation_validator.cc b/chrome/installer/util/installation_validator.cc index be5959a..b8812d3 100644 --- a/chrome/installer/util/installation_validator.cc +++ b/chrome/installer/util/installation_validator.cc @@ -202,7 +202,8 @@ void InstallationValidator::ValidateOnOsUpgradeCommand( bool* is_valid) { DCHECK(is_valid); - CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); + base::CommandLine cmd_line( + base::CommandLine::FromString(app_cmd.command_line())); base::string16 name(kCmdOnOsUpgrade); ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); @@ -231,7 +232,8 @@ void InstallationValidator::ValidateQueryEULAAcceptanceCommand( bool* is_valid) { DCHECK(is_valid); - CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); + base::CommandLine cmd_line( + base::CommandLine::FromString(app_cmd.command_line())); base::string16 name(kCmdQueryEULAAcceptance); ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); @@ -257,7 +259,8 @@ void InstallationValidator::ValidateQuickEnableApplicationHostCommand( bool* is_valid) { DCHECK(is_valid); - CommandLine cmd_line(CommandLine::FromString(app_cmd.command_line())); + base::CommandLine cmd_line( + base::CommandLine::FromString(app_cmd.command_line())); base::string16 name(kCmdQuickEnableApplicationHost); ValidateSetupPath(ctx, cmd_line.GetProgram(), name, is_valid); @@ -470,7 +473,7 @@ void InstallationValidator::ValidateSetupPath(const ProductContext& ctx, // Validates that |command| meets the expectations described in |expected|. void InstallationValidator::ValidateCommandExpectations( const ProductContext& ctx, - const CommandLine& command, + const base::CommandLine& command, const SwitchExpectations& expected, const base::string16& source, bool* is_valid) { @@ -492,7 +495,7 @@ void InstallationValidator::ValidateCommandExpectations( // the product described by |ctx| void InstallationValidator::ValidateUninstallCommand( const ProductContext& ctx, - const CommandLine& command, + const base::CommandLine& command, const base::string16& source, bool* is_valid) { DCHECK(is_valid); @@ -520,7 +523,8 @@ void InstallationValidator::ValidateRenameCommand(const ProductContext& ctx, DCHECK(is_valid); DCHECK(!ctx.state.rename_cmd().empty()); - CommandLine command = CommandLine::FromString(ctx.state.rename_cmd()); + base::CommandLine command = + base::CommandLine::FromString(ctx.state.rename_cmd()); base::string16 name(base::ASCIIToUTF16("in-use renamer")); ValidateSetupPath(ctx, command.GetProgram(), name, is_valid); diff --git a/chrome/installer/util/installation_validator_unittest.cc b/chrome/installer/util/installation_validator_unittest.cc index 941dc5c..ca12e2d 100644 --- a/chrome/installer/util/installation_validator_unittest.cc +++ b/chrome/installer/util/installation_validator_unittest.cc @@ -187,8 +187,8 @@ void FakeProductState::SetUninstallCommand(BrowserDistribution::Type dist_type, DCHECK(version); const bool is_multi_install = (channel_modifiers & CM_MULTI) != 0; - uninstall_command_ = CommandLine(GetSetupExePath(dist_type, install_level, - version, channel_modifiers)); + uninstall_command_ = base::CommandLine( + GetSetupExePath(dist_type, install_level, version, channel_modifiers)); uninstall_command_.AppendSwitch(installer::switches::kUninstall); if (install_level == SYSTEM_LEVEL) uninstall_command_.AppendSwitch(installer::switches::kSystemLevel); @@ -213,8 +213,8 @@ void FakeProductState::AddOsUpgradeCommand(BrowserDistribution::Type dist_type, // Right now only Chrome browser uses this. DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BROWSER); - CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, - channel_modifiers)); + base::CommandLine cmd_line( + GetSetupExePath(dist_type, install_level, version, channel_modifiers)); cmd_line.AppendSwitch(installer::switches::kOnOsUpgrade); // Imitating ChromeBrowserOperations::AppendProductFlags(). if ((channel_modifiers & CM_MULTI) != 0) { @@ -237,8 +237,8 @@ void FakeProductState::AddQueryEULAAcceptanceCommand( int channel_modifiers) { DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); - CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, - channel_modifiers)); + base::CommandLine cmd_line( + GetSetupExePath(dist_type, install_level, version, channel_modifiers)); cmd_line.AppendSwitch(installer::switches::kQueryEULAAcceptance); if (install_level == SYSTEM_LEVEL) cmd_line.AppendSwitch(installer::switches::kSystemLevel); @@ -258,8 +258,8 @@ void FakeProductState::AddQuickEnableApplicationHostCommand( DCHECK_EQ(dist_type, BrowserDistribution::CHROME_BINARIES); DCHECK_NE(channel_modifiers & CM_MULTI, 0); - CommandLine cmd_line(GetSetupExePath(dist_type, install_level, version, - channel_modifiers)); + base::CommandLine cmd_line( + GetSetupExePath(dist_type, install_level, version, channel_modifiers)); cmd_line.AppendSwitch(installer::switches::kMultiInstall); cmd_line.AppendSwitch(installer::switches::kChromeAppLauncher); cmd_line.AppendSwitch(installer::switches::kEnsureGoogleUpdatePresent); diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index d204277..520fd58 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -88,7 +88,7 @@ InstallerState::InstallerState(Level level) set_level(level); } -void InstallerState::Initialize(const CommandLine& command_line, +void InstallerState::Initialize(const base::CommandLine& command_line, const MasterPreferences& prefs, const InstallationState& machine_state) { Clear(); diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 4faaee0..c9b5940 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -76,7 +76,7 @@ void CreateTextFile(const std::wstring& filename, void BuildSingleChromeState(const base::FilePath& target_dir, MockInstallerState* installer_state) { - CommandLine cmd_line = CommandLine::FromString(L"setup.exe"); + base::CommandLine cmd_line = base::CommandLine::FromString(L"setup.exe"); MasterPreferences prefs(cmd_line); InstallationState machine_state; machine_state.Initialize(); @@ -249,7 +249,7 @@ TEST_F(InstallerStateTest, DeleteInUsed) { TEST_F(InstallerStateTest, Basic) { const bool multi_install = false; const bool system_level = true; - CommandLine cmd_line = CommandLine::FromString( + base::CommandLine cmd_line = base::CommandLine::FromString( std::wstring(L"setup.exe") + (multi_install ? L" --multi-install --chrome" : L"") + (system_level ? L" --system-level" : L"")); @@ -332,7 +332,7 @@ TEST_F(InstallerStateTest, Basic) { TEST_F(InstallerStateTest, WithProduct) { const bool multi_install = false; const bool system_level = true; - CommandLine cmd_line = CommandLine::FromString( + base::CommandLine cmd_line = base::CommandLine::FromString( std::wstring(L"setup.exe") + (multi_install ? L" --multi-install --chrome" : L"") + (system_level ? L" --system-level" : L"")); @@ -385,7 +385,8 @@ TEST_F(InstallerStateTest, InstallerResult) { { RegistryOverrideManager override_manager; override_manager.OverrideRegistry(root); - CommandLine cmd_line = CommandLine::FromString(L"setup.exe --system-level"); + base::CommandLine cmd_line = + base::CommandLine::FromString(L"setup.exe --system-level"); const MasterPreferences prefs(cmd_line); InstallationState machine_state; machine_state.Initialize(); @@ -416,7 +417,7 @@ TEST_F(InstallerStateTest, InstallerResult) { { RegistryOverrideManager override_manager; override_manager.OverrideRegistry(root); - CommandLine cmd_line = CommandLine::FromString( + base::CommandLine cmd_line = base::CommandLine::FromString( L"setup.exe --system-level --multi-install --chrome"); const MasterPreferences prefs(cmd_line); InstallationState machine_state; @@ -457,8 +458,8 @@ TEST_F(InstallerStateTest, GetCurrentVersionMigrateChrome) { new Version(chrome::kChromeVersion)); // Now we're invoked to install multi Chrome. - CommandLine cmd_line( - CommandLine::FromString(L"setup.exe --multi-install --chrome")); + base::CommandLine cmd_line( + base::CommandLine::FromString(L"setup.exe --multi-install --chrome")); MasterPreferences prefs(cmd_line); InstallerState installer_state; installer_state.Initialize(cmd_line, prefs, machine_state); @@ -625,8 +626,8 @@ TEST_F(InstallerStateTest, InitializeTwice) { // Initialize the instance to install multi Chrome. { - CommandLine cmd_line( - CommandLine::FromString(L"setup.exe --multi-install --chrome")); + base::CommandLine cmd_line( + base::CommandLine::FromString(L"setup.exe --multi-install --chrome")); MasterPreferences prefs(cmd_line); installer_state.Initialize(cmd_line, prefs, machine_state); } @@ -648,8 +649,8 @@ TEST_F(InstallerStateTest, InitializeTwice) { // Now initialize it to install system-level single Chrome. { - CommandLine cmd_line( - CommandLine::FromString(L"setup.exe --system-level --verbose-logging")); + base::CommandLine cmd_line(base::CommandLine::FromString( + L"setup.exe --system-level --verbose-logging")); MasterPreferences prefs(cmd_line); installer_state.Initialize(cmd_line, prefs, machine_state); } @@ -675,7 +676,8 @@ TEST_F(InstallerStateTest, InitializeTwice) { // tests must invoke Initialize() with a critical version. class InstallerStateCriticalVersionTest : public ::testing::Test { protected: - InstallerStateCriticalVersionTest() : cmd_line_(CommandLine::NO_PROGRAM) {} + InstallerStateCriticalVersionTest() + : cmd_line_(base::CommandLine::NO_PROGRAM) {} // Creates a set of versions for use by all test runs. static void SetUpTestCase() { @@ -699,11 +701,10 @@ class InstallerStateCriticalVersionTest : public ::testing::Test { // instance's critical update version is set to |version|. |version| may be // NULL, in which case the critical update version is unset. MockInstallerState& Initialize(const Version* version) { - cmd_line_ = version == NULL ? - CommandLine::FromString(L"setup.exe") : - CommandLine::FromString( - L"setup.exe --critical-update-version=" + - base::ASCIIToUTF16(version->GetString())); + cmd_line_ = version == NULL ? base::CommandLine::FromString(L"setup.exe") + : base::CommandLine::FromString( + L"setup.exe --critical-update-version=" + + base::ASCIIToUTF16(version->GetString())); prefs_.reset(new MasterPreferences(cmd_line_)); machine_state_.Initialize(); installer_state_.Initialize(cmd_line_, *prefs_, machine_state_); @@ -716,7 +717,7 @@ class InstallerStateCriticalVersionTest : public ::testing::Test { static Version* pv_version_; static Version* high_version_; - CommandLine cmd_line_; + base::CommandLine cmd_line_; scoped_ptr<MasterPreferences> prefs_; InstallationState machine_state_; MockInstallerState installer_state_; diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index de4d552..7bf5c2f7 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -75,10 +75,10 @@ MasterPreferences::MasterPreferences() : distribution_(NULL), chrome_(true), chrome_app_launcher_(false), multi_install_(false) { - InitializeFromCommandLine(*CommandLine::ForCurrentProcess()); + InitializeFromCommandLine(*base::CommandLine::ForCurrentProcess()); } -MasterPreferences::MasterPreferences(const CommandLine& cmd_line) +MasterPreferences::MasterPreferences(const base::CommandLine& cmd_line) : distribution_(NULL), preferences_read_from_file_(false), chrome_(true), @@ -117,7 +117,8 @@ MasterPreferences::MasterPreferences(const std::string& prefs) MasterPreferences::~MasterPreferences() { } -void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) { +void MasterPreferences::InitializeFromCommandLine( + const base::CommandLine& cmd_line) { #if defined(OS_WIN) if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { base::FilePath prefs_path(cmd_line.GetSwitchValuePath( diff --git a/chrome/installer/util/master_preferences_dummy.cc b/chrome/installer/util/master_preferences_dummy.cc index 971032a..54b7e67 100644 --- a/chrome/installer/util/master_preferences_dummy.cc +++ b/chrome/installer/util/master_preferences_dummy.cc @@ -15,7 +15,7 @@ namespace installer { -MasterPreferences::MasterPreferences(const CommandLine& cmd_line) +MasterPreferences::MasterPreferences(const base::CommandLine& cmd_line) : distribution_(NULL), preferences_read_from_file_(false) { } @@ -49,7 +49,7 @@ std::vector<std::string> MasterPreferences::GetFirstRunTabs() const { // static const MasterPreferences& MasterPreferences::ForCurrentProcess() { - static MasterPreferences prefs(*CommandLine::ForCurrentProcess()); + static MasterPreferences prefs(*base::CommandLine::ForCurrentProcess()); return prefs; } diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 56c7f8c..02bb393 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -258,7 +258,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { std::wstring cmd_str( L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); cmd_str.append(L" --do-not-launch-chrome"); - CommandLine cmd_line = CommandLine::FromString(cmd_str); + base::CommandLine cmd_line = base::CommandLine::FromString(cmd_str); installer::MasterPreferences prefs(cmd_line); // Check prefs that do not have any equivalent command line option. @@ -303,7 +303,8 @@ TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { std::wstringstream chrome_cmd; chrome_cmd << "setup.exe"; - CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); + base::CommandLine chrome_install( + base::CommandLine::FromString(chrome_cmd.str())); installer::MasterPreferences pref_chrome(chrome_install); @@ -318,7 +319,8 @@ TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; - CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); + base::CommandLine chrome_install( + base::CommandLine::FromString(chrome_cmd.str())); installer::MasterPreferences pref_chrome(chrome_install); diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index d5dd118..89486a8 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc @@ -58,26 +58,26 @@ void Product::InitializeFromPreferences(const MasterPreferences& prefs) { } void Product::InitializeFromUninstallCommand( - const CommandLine& uninstall_command) { + const base::CommandLine& uninstall_command) { operations_->ReadOptions(uninstall_command, &options_); } bool Product::LaunchChrome(const base::FilePath& application_path) const { bool success = !application_path.empty(); if (success) { - CommandLine cmd(application_path.Append(installer::kChromeExe)); + base::CommandLine cmd(application_path.Append(installer::kChromeExe)); success = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid(); } return success; } bool Product::LaunchChromeAndWait(const base::FilePath& application_path, - const CommandLine& options, + const base::CommandLine& options, int32* exit_code) const { if (application_path.empty()) return false; - CommandLine cmd(application_path.Append(installer::kChromeExe)); + base::CommandLine cmd(application_path.Append(installer::kChromeExe)); cmd.AppendArguments(options, false); bool success = false; @@ -143,11 +143,11 @@ void Product::AddComDllList(std::vector<base::FilePath>* com_dll_list) const { operations_->AddComDllList(options_, com_dll_list); } -void Product::AppendProductFlags(CommandLine* command_line) const { +void Product::AppendProductFlags(base::CommandLine* command_line) const { operations_->AppendProductFlags(options_, command_line); } -void Product::AppendRenameFlags(CommandLine* command_line) const { +void Product::AppendRenameFlags(base::CommandLine* command_line) const { operations_->AppendRenameFlags(options_, command_line); } diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index 6c311d1..d499548 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -51,7 +51,7 @@ TEST_F(ProductTest, ProductInstallBasic) { // TODO(tommi): We should mock this and use our mocked distribution. const bool multi_install = false; const bool system_level = true; - CommandLine cmd_line = CommandLine::FromString( + base::CommandLine cmd_line = base::CommandLine::FromString( std::wstring(L"setup.exe") + (multi_install ? L" --multi-install --chrome" : L"") + (system_level ? L" --system-level" : L"")); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 22261c1..5a70fb9 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -850,12 +850,13 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, KEY_READ | KEY_WOW64_32KEY); base::string16 uninstall_string; key.ReadValue(installer::kUninstallStringField, &uninstall_string); - CommandLine command_line = CommandLine::FromString(uninstall_string); + base::CommandLine command_line = + base::CommandLine::FromString(uninstall_string); exe_path = command_line.GetProgram(); } if (base::PathExists(exe_path)) { - CommandLine cmd(exe_path); + base::CommandLine cmd(exe_path); cmd.AppendSwitchPath(installer::switches::kRegisterChromeBrowser, chrome_exe); if (!suffix.empty()) { @@ -1249,7 +1250,7 @@ ShellUtil::DefaultState ProbeOpenCommandHandlers( base::string16 key_path; base::win::RegKey key; base::string16 value; - CommandLine command_line(CommandLine::NO_PROGRAM); + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); base::string16 short_path; for (size_t i = 0; i < num_protocols; ++i) { @@ -1262,7 +1263,7 @@ ShellUtil::DefaultState ProbeOpenCommandHandlers( } // Need to normalize path in case it's been munged. - command_line = CommandLine::FromString(value); + command_line = base::CommandLine::FromString(value); if (!ShortNameFromPath(command_line.GetProgram(), &short_path)) return ShellUtil::UNKNOWN_DEFAULT; @@ -1423,15 +1424,15 @@ bool ShortcutOpListOrRemoveUnknownArgs( if (!base::win::ResolveShortcut(shortcut_path, NULL, &args)) return false; - CommandLine current_args(CommandLine::FromString(base::StringPrintf( - L"unused_program %ls", args.c_str()))); + base::CommandLine current_args(base::CommandLine::FromString( + base::StringPrintf(L"unused_program %ls", args.c_str()))); const char* const kept_switches[] = { switches::kApp, switches::kAppId, switches::kShowAppList, switches::kProfileDirectory, }; - CommandLine desired_args(CommandLine::NO_PROGRAM); + base::CommandLine desired_args(base::CommandLine::NO_PROGRAM); desired_args.CopySwitchesFrom(current_args, kept_switches, arraysize(kept_switches)); if (desired_args.argv().size() == current_args.argv().size()) @@ -1846,7 +1847,7 @@ base::string16 ShellUtil::GetBrowserModelId(BrowserDistribution* dist, // TODO(robertshield): Temporary hack to make the kRegisterChromeBrowserSuffix // apply to all registry values computed down in these murky depths. - CommandLine& command_line = *CommandLine::ForCurrentProcess(); + base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch( installer::switches::kRegisterChromeBrowserSuffix)) { suffix = command_line.GetSwitchValueNative( @@ -2155,7 +2156,7 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist, return false; } - CommandLine& command_line = *CommandLine::ForCurrentProcess(); + base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); base::string16 suffix; if (!unique_suffix.empty()) { diff --git a/chrome/installer/util/user_experiment.cc b/chrome/installer/util/user_experiment.cc index 2b646c1..b6a09894 100644 --- a/chrome/installer/util/user_experiment.cc +++ b/chrome/installer/util/user_experiment.cc @@ -111,8 +111,9 @@ int GetUserDataDirectoryWriteAgeInHours() { // If handle to experiment result key was given at startup, re-add it. // Does not wait for the process to terminate. // |cmd_line| may be modified as a result of this call. -bool LaunchSetup(CommandLine* cmd_line, bool system_level_toast) { - const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); +bool LaunchSetup(base::CommandLine* cmd_line, bool system_level_toast) { + const base::CommandLine& current_cmd_line = + *base::CommandLine::ForCurrentProcess(); // Propagate --verbose-logging to the invoked setup.exe. if (current_cmd_line.HasSwitch(switches::kVerboseLogging)) @@ -202,13 +203,14 @@ bool FixDACLsForExecute(const base::FilePath& exe) { // the computer is on but nobody has logged in locally. // Remote Desktop sessions do not count as interactive sessions; running this // method as a user logged in via remote desktop will do nothing. -bool LaunchSetupAsConsoleUser(CommandLine* cmd_line) { +bool LaunchSetupAsConsoleUser(base::CommandLine* cmd_line) { // Convey to the invoked setup.exe that it's operating on a system-level // installation. cmd_line->AppendSwitch(switches::kSystemLevel); // Propagate --verbose-logging to the invoked setup.exe. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVerboseLogging)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kVerboseLogging)) cmd_line->AppendSwitch(switches::kVerboseLogging); // Get the Google Update results key, and pass it on the command line to @@ -258,7 +260,7 @@ void SetClient(const base::string16& experiment_group, bool last_write) { // If a specific Toast Results key handle (presumably to our HKLM key) was // passed in to the command line (such as for system level installs), we use // it. Otherwise, we write to the key under HKCU. - const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); + const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); if (cmd_line.HasSwitch(switches::kToastResultsKey)) { // Get the handle to the key under HKLM. base::StringToInt( @@ -391,12 +393,12 @@ bool CreateExperimentDetails(int flavor, ExperimentDetails* experiment) { // 2- Is a system-install and it updated : relaunch as the interactive user // 3- It has been re-launched from the #2 case. In this case we enter // this function with |system_install| true and a REENTRY_SYS_UPDATE status. -void LaunchBrowserUserExperiment(const CommandLine& base_cmd_line, +void LaunchBrowserUserExperiment(const base::CommandLine& base_cmd_line, InstallStatus status, bool system_level) { if (system_level) { if (NEW_VERSION_UPDATED == status) { - CommandLine cmd_line(base_cmd_line); + base::CommandLine cmd_line(base_cmd_line); cmd_line.AppendSwitch(switches::kSystemLevelToast); // We need to relaunch as the interactive user. LaunchSetupAsConsoleUser(&cmd_line); @@ -470,7 +472,7 @@ void LaunchBrowserUserExperiment(const CommandLine& base_cmd_line, // because google_update expects the upgrade process to be quick and nimble. // System level: We have already been relaunched, so we don't need to be // quick, but we relaunch to follow the exact same codepath. - CommandLine cmd_line(base_cmd_line); + base::CommandLine cmd_line(base_cmd_line); cmd_line.AppendSwitchASCII(switches::kInactiveUserToast, base::IntToString(flavor)); cmd_line.AppendSwitchASCII(switches::kExperimentGroup, @@ -485,7 +487,7 @@ void InactiveUserToastExperiment(int flavor, const Product& product, const base::FilePath& application_path) { // Add the 'welcome back' url for chrome to show. - CommandLine options(CommandLine::NO_PROGRAM); + base::CommandLine options(base::CommandLine::NO_PROGRAM); options.AppendSwitchNative(::switches::kTryChromeAgain, base::IntToString16(flavor)); // Prepend the url with a space. @@ -525,11 +527,11 @@ void InactiveUserToastExperiment(int flavor, // The user wants to uninstall. This is a best effort operation. Note that // we waited for chrome to exit so the uninstall would not detect chrome // running. - bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( + bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kSystemLevelToast); - CommandLine cmd(InstallUtil::GetChromeUninstallCmd( - system_level_toast, product.distribution()->GetType())); + base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd( + system_level_toast, product.distribution()->GetType())); base::LaunchProcess(cmd, base::LaunchOptions()); } |