diff options
Diffstat (limited to 'chrome/installer/util')
21 files changed, 124 insertions, 109 deletions
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()); } |