diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 01:46:59 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 01:46:59 +0000 |
commit | ed578097fa1a348906fdd74ea32bf140c8f75071 (patch) | |
tree | 46decb9874a9573f64a3a86893a7dec063fa97fb /chrome/installer/util | |
parent | abb4e8e1ecd63ce8d80e7ab514b748c2cbf201b8 (diff) | |
download | chromium_src-ed578097fa1a348906fdd74ea32bf140c8f75071.zip chromium_src-ed578097fa1a348906fdd74ea32bf140c8f75071.tar.gz chromium_src-ed578097fa1a348906fdd74ea32bf140c8f75071.tar.bz2 |
Remove GetSwitchValue() from chrome/* where easy.
Review URL: http://codereview.chromium.org/3057033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/logging_installer.cc | 11 | ||||
-rw-r--r-- | chrome/installer/util/logging_installer.h | 3 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.cc | 18 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 16 |
7 files changed, 33 insertions, 30 deletions
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 15e1d2a..8a2069d 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -129,10 +129,10 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { // Launches again this same process with switch --|flag|=|value|. // If system_level_toast is true, appends --system-level-toast. // Does not wait for the process to terminate. -bool RelaunchSetup(const std::wstring& flag, int value, +bool RelaunchSetup(const std::string& flag, int value, bool system_level_toast) { CommandLine cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); - cmd_line.AppendSwitchASCII(WideToASCII(flag), base::IntToString(value)); + cmd_line.AppendSwitchASCII(flag, base::IntToString(value)); if (system_level_toast) cmd_line.AppendSwitch( WideToASCII(installer_util::switches::kSystemLevelToast)); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 3f11eb5..9dfda73 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -29,7 +29,7 @@ void InitInstallerLogging(const CommandLine& command_line) { return; } - logging::InitLogging(GetLogFilePath(command_line).c_str(), + logging::InitLogging(GetLogFilePath(command_line).value().c_str(), logging::LOG_ONLY_TO_FILE, logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); @@ -50,10 +50,10 @@ void EndInstallerLogging() { installer_logging_ = false; } -std::wstring GetLogFilePath(const CommandLine& command_line) { +FilePath GetLogFilePath(const CommandLine& command_line) { if (command_line.HasSwitch( WideToASCII(installer_util::switches::kLogFile))) { - return command_line.GetSwitchValue( + return command_line.GetSwitchValuePath( WideToASCII(installer_util::switches::kLogFile)); } @@ -65,12 +65,11 @@ std::wstring GetLogFilePath(const CommandLine& command_line) { } FilePath log_path; - if (PathService::Get(base::DIR_TEMP, &log_path)) { log_path = log_path.Append(log_filename); - return log_path.ToWStringHack(); + return log_path; } else { - return log_filename; + return FilePath(log_filename); } } diff --git a/chrome/installer/util/logging_installer.h b/chrome/installer/util/logging_installer.h index c2b0a96..50882dc 100644 --- a/chrome/installer/util/logging_installer.h +++ b/chrome/installer/util/logging_installer.h @@ -11,6 +11,7 @@ #include "base/logging.h" class CommandLine; +class FilePath; namespace installer { @@ -21,7 +22,7 @@ void InitInstallerLogging(const CommandLine& command_line); void EndInstallerLogging(); // Returns the full path of the log file. -std::wstring GetLogFilePath(const CommandLine& command_line); +FilePath GetLogFilePath(const CommandLine& command_line); } // namespace installer diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 053dc45..293d35b 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" +#include "base/string_util.h" #include "chrome/common/json_value_serializer.h" #include "chrome/installer/util/util_constants.h" #include "googleurl/src/gurl.h" @@ -106,8 +107,8 @@ DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) { DictionaryValue* prefs = NULL; #if defined(OS_WIN) if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - FilePath prefs_path( - cmd_line.GetSwitchValue(installer_util::switches::kInstallerData)); + FilePath prefs_path = cmd_line.GetSwitchValuePath( + installer_util::switches::kInstallerData); prefs = installer_util::ParseDistributionPreferences(prefs_path); } diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 66b6382..56685ad 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -309,11 +309,13 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe, } if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) { std::wstring params(L"--"); - params.append(installer_util::switches::kRegisterChromeBrowser); + params.append( + ASCIIToWide(installer_util::switches::kRegisterChromeBrowser)); params.append(L"=\"" + chrome_exe + L"\""); if (!suffix.empty()) { params.append(L" --"); - params.append(installer_util::switches::kRegisterChromeBrowserSuffix); + params.append(ASCIIToWide( + installer_util::switches::kRegisterChromeBrowserSuffix)); params.append(L"=\"" + suffix + L"\""); } diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index d7e7d3d..d6b4efe 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -48,10 +48,10 @@ const wchar_t kEnableLogging[] = L"enable-logging"; const wchar_t kForceUninstall[] = L"force-uninstall"; // Specify the file path of Chrome archive for install. -const wchar_t kInstallArchive[] = L"install-archive"; +const char kInstallArchive[] = "install-archive"; // Specify the file path of Chrome master preference file. -const wchar_t kInstallerData[] = L"installerdata"; +const char kInstallerData[] = "installerdata"; // If present, specify file path to write logging info. const wchar_t kLogFile[] = L"log-file"; @@ -67,15 +67,15 @@ const wchar_t kMsi[] = L"msi"; // Useful only when used with --update-setup-exe, otherwise ignored. It // specifies the full path where updated setup.exe will be stored. -const wchar_t kNewSetupExe[] = L"new-setup-exe"; +const char kNewSetupExe[] = "new-setup-exe"; // Register Chrome as a valid browser on the current sytem. This option // requires that setup.exe is running as admin. If this option is specified, // options kInstallArchive and kUninstall are ignored. -const wchar_t kRegisterChromeBrowser[] = L"register-chrome-browser"; +const char kRegisterChromeBrowser[] = "register-chrome-browser"; -const wchar_t kRegisterChromeBrowserSuffix[] = - L"register-chrome-browser-suffix"; +const char kRegisterChromeBrowserSuffix[] = + "register-chrome-browser-suffix"; // Renames chrome.exe to old_chrome.exe and renames new_chrome.exe to chrome.exe // to support in-use updates. Also deletes opv key. @@ -97,19 +97,19 @@ const wchar_t kUninstall[] = L"uninstall"; // Also see --new-setup-exe. This command line option specifies a diff patch // that setup.exe will apply to itself and store the resulting binary in the // path given by --new-setup-exe. -const wchar_t kUpdateSetupExe[] = L"update-setup-exe"; +const char kUpdateSetupExe[] = "update-setup-exe"; // Enable verbose logging (info level). const wchar_t kVerboseLogging[] = L"verbose-logging"; // Show the embedded EULA dialog. -const wchar_t kShowEula[] = L"show-eula"; +const char kShowEula[] = "show-eula"; // Use the alternate desktop shortcut name. const wchar_t kAltDesktopShortcut[] = L"alt-desktop-shortcut"; // Perform the inactive user toast experiment. -const wchar_t kInactiveUserToast[] = L"inactive-user-toast"; +const char kInactiveUserToast[] = "inactive-user-toast"; // User toast experiment switch from system context to user context. const wchar_t kSystemLevelToast[] = L"system-level-toast"; diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index ddecd71..8501c03 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -62,24 +62,24 @@ extern const wchar_t kDoNotRegisterForUpdateLaunch[]; extern const wchar_t kDoNotRemoveSharedItems[]; extern const wchar_t kEnableLogging[]; extern const wchar_t kForceUninstall[]; -extern const wchar_t kInstallArchive[]; -extern const wchar_t kInstallerData[]; +extern const char kInstallArchive[]; +extern const char kInstallerData[]; extern const wchar_t kLogFile[]; extern const wchar_t kMakeChromeDefault[]; extern const wchar_t kMsi[]; -extern const wchar_t kNewSetupExe[]; -extern const wchar_t kRegisterChromeBrowser[]; -extern const wchar_t kRegisterChromeBrowserSuffix[]; +extern const char kNewSetupExe[]; +extern const char kRegisterChromeBrowser[]; +extern const char kRegisterChromeBrowserSuffix[]; extern const wchar_t kRenameChromeExe[]; extern const wchar_t kRemoveChromeRegistration[]; extern const wchar_t kRunAsAdmin[]; extern const wchar_t kSystemLevel[]; extern const wchar_t kUninstall[]; -extern const wchar_t kUpdateSetupExe[]; +extern const char kUpdateSetupExe[]; extern const wchar_t kVerboseLogging[]; -extern const wchar_t kShowEula[]; +extern const char kShowEula[]; extern const wchar_t kAltDesktopShortcut[]; -extern const wchar_t kInactiveUserToast[]; +extern const char kInactiveUserToast[]; extern const wchar_t kSystemLevelToast[]; } // namespace switches |