summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/setup_main.cc24
-rw-r--r--chrome/installer/setup/uninstall.cc3
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc4
-rw-r--r--chrome/installer/util/logging_installer.cc11
-rw-r--r--chrome/installer/util/logging_installer.h3
-rw-r--r--chrome/installer/util/master_preferences.cc5
-rw-r--r--chrome/installer/util/shell_util.cc6
-rw-r--r--chrome/installer/util/util_constants.cc18
-rw-r--r--chrome/installer/util/util_constants.h16
9 files changed, 47 insertions, 43 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index c6e8c60..41b1c95 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -231,7 +231,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
// If --install-archive is given, get the user specified value
if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) {
- archive = cmd_line.GetSwitchValue(
+ archive = cmd_line.GetSwitchValueNative(
installer_util::switches::kInstallArchive);
}
LOG(INFO) << "Archive found to install Chrome " << archive;
@@ -287,7 +287,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
// uncompressing and binary patching. Get the location for this file.
std::wstring archive_to_copy(temp_path.ToWStringHack());
file_util::AppendToPath(&archive_to_copy, installer::kChromeArchive);
- std::wstring prefs_source_path = cmd_line.GetSwitchValue(
+ std::wstring prefs_source_path = cmd_line.GetSwitchValueNative(
installer_util::switches::kInstallerData);
install_status = installer::InstallOrUpdateChrome(
cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(),
@@ -354,7 +354,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
LOG(INFO) << "Deleting temporary directory " << temp_path.value();
bool cleanup_success = file_util::Delete(temp_path, true);
if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
- std::wstring prefs_path = cmd_line.GetSwitchValue(
+ std::wstring prefs_path = cmd_line.GetSwitchValueNative(
installer_util::switches::kInstallerData);
cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success;
}
@@ -368,7 +368,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line,
if (!cleanup_success) {
ScheduleDirectoryForDeletion(temp_path.ToWStringHack().c_str());
if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) {
- std::wstring prefs_path = cmd_line.GetSwitchValue(
+ std::wstring prefs_path = cmd_line.GetSwitchValueNative(
installer_util::switches::kInstallerData);
ScheduleDirectoryForDeletion(prefs_path.c_str());
}
@@ -446,14 +446,14 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) {
LOG(ERROR) << "Could not create temporary path.";
} else {
- std::wstring setup_patch = cmd_line.GetSwitchValue(
+ std::wstring setup_patch = cmd_line.GetSwitchValueNative(
installer_util::switches::kUpdateSetupExe);
LOG(INFO) << "Opening archive " << setup_patch;
std::wstring uncompressed_patch;
if (LzmaUtil::UnPackArchive(setup_patch, temp_path.ToWStringHack(),
&uncompressed_patch) == NO_ERROR) {
std::wstring old_setup_exe = cmd_line.program();
- std::wstring new_setup_exe = cmd_line.GetSwitchValue(
+ std::wstring new_setup_exe = cmd_line.GetSwitchValueNative(
installer_util::switches::kNewSetupExe);
if (!setup_util::ApplyDiffPatch(old_setup_exe, uncompressed_patch,
new_setup_exe))
@@ -473,7 +473,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
// Check if we need to show the EULA. If it is passed as a command line
// then the dialog is shown and regardless of the outcome setup exits here.
std::wstring inner_frame =
- cmd_line.GetSwitchValue(installer_util::switches::kShowEula);
+ cmd_line.GetSwitchValueNative(installer_util::switches::kShowEula);
exit_code = ShowEULADialog(inner_frame);
if (installer_util::EULA_REJECTED != exit_code)
GoogleUpdateSettings::SetEULAConsent(true);
@@ -485,12 +485,12 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
// browser for Start Menu->Internet shortcut. This option should only
// be used when setup.exe is launched with admin rights. We do not
// make any user specific changes in this option.
- std::wstring chrome_exe(cmd_line.GetSwitchValue(
+ std::wstring chrome_exe(cmd_line.GetSwitchValueNative(
installer_util::switches::kRegisterChromeBrowser));
std::wstring suffix;
if (cmd_line.HasSwitch(
installer_util::switches::kRegisterChromeBrowserSuffix)) {
- suffix = cmd_line.GetSwitchValue(
+ suffix = cmd_line.GetSwitchValueNative(
installer_util::switches::kRegisterChromeBrowserSuffix);
}
exit_code = ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false);
@@ -509,7 +509,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
std::wstring suffix;
if (cmd_line.HasSwitch(
installer_util::switches::kRegisterChromeBrowserSuffix)) {
- suffix = cmd_line.GetSwitchValue(
+ suffix = cmd_line.GetSwitchValueNative(
installer_util::switches::kRegisterChromeBrowserSuffix);
}
installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS;
@@ -519,8 +519,8 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line,
return true;
} else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) {
// Launch the inactive user toast experiment.
- std::wstring flavor =
- cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast);
+ std::string flavor = cmd_line.GetSwitchValueASCII(
+ installer_util::switches::kInactiveUserToast);
int flavor_int;
base::StringToInt(flavor, &flavor_int);
dist->InactiveUserToastExperiment(flavor_int,
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index bbee52e..ff3eac9 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -469,7 +469,8 @@ installer_util::InstallStatus installer_setup::UninstallChrome(
params.append(installer_util::switches::kRemoveChromeRegistration);
if (!suffix.empty()) {
params.append(L" --");
- params.append(installer_util::switches::kRegisterChromeBrowserSuffix);
+ params.append(ASCIIToWide(
+ installer_util::switches::kRegisterChromeBrowserSuffix));
params.append(L"=\"" + suffix + L"\"");
}
DWORD exit_code = installer_util::UNKNOWN_STATUS;
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