summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/chrome_crash_reporter_client.cc2
-rw-r--r--chrome/app/client_util.cc71
-rw-r--r--chrome/app/client_util.h12
-rw-r--r--chrome/browser/diagnostics/recon_diagnostics.cc2
-rw-r--r--chrome/browser/first_run/first_run_internal_win.cc4
-rw-r--r--chrome/browser/first_run/upgrade_util_win.cc3
-rw-r--r--chrome/browser/google/did_run_updater_win.cc2
-rw-r--r--chrome/browser/google/google_update_win.cc6
-rw-r--r--chrome/browser/metrics/variations/variations_registry_syncer_win.cc3
-rw-r--r--chrome/browser/metro_utils/metro_chrome_win.cc6
-rw-r--r--chrome/browser/shell_integration_win.cc24
-rw-r--r--chrome/browser/ui/views/app_list/win/app_list_service_win.cc3
-rw-r--r--chrome/browser/upgrade_detector_impl.cc2
-rw-r--r--chrome/common/chrome_version_info_win.cc7
-rw-r--r--chrome/installer/setup/install.cc6
-rw-r--r--chrome/installer/setup/install_worker.cc2
-rw-r--r--chrome/installer/setup/setup_main.cc25
-rw-r--r--chrome/installer/setup/uninstall.cc13
-rw-r--r--chrome/installer/setup/uninstall.h2
-rw-r--r--chrome/installer/util/chrome_browser_operations.cc3
-rw-r--r--chrome/installer/util/google_update_settings.cc2
-rw-r--r--chrome/installer/util/google_update_util.cc3
-rw-r--r--chrome/installer/util/install_util.cc4
-rw-r--r--chrome/installer/util/install_util.h8
-rw-r--r--chrome/installer/util/install_util_unittest.cc4
-rw-r--r--chrome/installer/util/shell_util.cc110
-rw-r--r--chrome/installer/util/shell_util.h24
-rw-r--r--win8/delegate_execute/chrome_util.cc2
-rw-r--r--win8/delegate_execute/command_execute_impl.cc3
29 files changed, 161 insertions, 197 deletions
diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc
index c5f2657..6f0855e2 100644
--- a/chrome/app/chrome_crash_reporter_client.cc
+++ b/chrome/app/chrome_crash_reporter_client.cc
@@ -182,7 +182,7 @@ bool ChromeCrashReporterClient::GetDeferredUploadsSupported(
bool ChromeCrashReporterClient::GetIsPerUserInstall(
const base::FilePath& exe_path) {
- return InstallUtil::IsPerUserInstall(exe_path.value().c_str());
+ return InstallUtil::IsPerUserInstall(exe_path);
}
bool ChromeCrashReporterClient::GetShouldDumpLargerDumps(
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
index f73c472..a527173 100644
--- a/chrome/app/client_util.cc
+++ b/chrome/app/client_util.cc
@@ -47,34 +47,31 @@ typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)();
base::LazyInstance<chrome::ChromeCrashReporterClient>::Leaky
g_chrome_crash_client = LAZY_INSTANCE_INITIALIZER;
-// Expects that |dir| has a trailing backslash. |dir| is modified so it
-// contains the full path that was tried. Caller must check for the return
-// value not being null to determine if this path contains a valid dll.
-HMODULE LoadModuleWithDirectory(base::string16* dir,
- const base::char16* dll_name,
- bool pre_read) {
- ::SetCurrentDirectoryW(dir->c_str());
- dir->append(dll_name);
+// Loads |module| after setting the CWD to |module|'s directory. Returns a
+// reference to the loaded module on success, or null on error.
+HMODULE LoadModuleWithDirectory(const base::FilePath& module, bool pre_read) {
+ ::SetCurrentDirectoryW(module.DirName().value().c_str());
if (pre_read) {
// We pre-read the binary to warm the memory caches (fewer hard faults to
// page parts of the binary in).
const size_t kStepSize = 1024 * 1024;
size_t percent = 100;
- ImagePreReader::PartialPreReadImage(dir->c_str(), percent, kStepSize);
+ ImagePreReader::PartialPreReadImage(module.value().c_str(), percent,
+ kStepSize);
}
- return ::LoadLibraryExW(dir->c_str(), nullptr,
+ return ::LoadLibraryExW(module.value().c_str(), nullptr,
LOAD_WITH_ALTERED_SEARCH_PATH);
}
-void RecordDidRun(const base::string16& dll_path) {
- bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
+void RecordDidRun(const base::FilePath& dll_path) {
+ bool system_level = !InstallUtil::IsPerUserInstall(dll_path);
GoogleUpdateSettings::UpdateDidRunState(true, system_level);
}
-void ClearDidRun(const base::string16& dll_path) {
- bool system_level = !InstallUtil::IsPerUserInstall(dll_path.c_str());
+void ClearDidRun(const base::FilePath& dll_path) {
+ bool system_level = !InstallUtil::IsPerUserInstall(dll_path);
GoogleUpdateSettings::UpdateDidRunState(false, system_level);
}
@@ -85,17 +82,15 @@ bool InMetroMode() {
typedef int (*InitMetro)();
-} // namespace
-
-base::string16 GetExecutablePath() {
+// Returns the directory in which the currently running executable resides.
+base::FilePath GetExecutableDir() {
base::char16 path[MAX_PATH];
::GetModuleFileNameW(nullptr, path, MAX_PATH);
- if (!::PathRemoveFileSpecW(path))
- return base::string16();
- base::string16 exe_path(path);
- return exe_path.append(1, L'\\');
+ return base::FilePath(path).DirName();
}
+} // namespace
+
base::string16 GetCurrentModuleVersion() {
scoped_ptr<FileVersionInfo> file_version_info(
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
@@ -122,11 +117,7 @@ MainDllLoader::~MainDllLoader() {
// If that fails then we look at the version resource in the current
// module. This is the expected path for chrome.exe browser instances in an
// installed build.
-HMODULE MainDllLoader::Load(base::string16* version,
- base::string16* out_file) {
- const base::string16 executable_dir(GetExecutablePath());
- *out_file = executable_dir;
-
+HMODULE MainDllLoader::Load(base::string16* version, base::FilePath* module) {
const base::char16* dll_name = nullptr;
if (metro_mode_) {
dll_name = installer::kChromeMetroDll;
@@ -143,19 +134,20 @@ HMODULE MainDllLoader::Load(base::string16* version,
}
const bool pre_read = !metro_mode_;
- HMODULE dll = LoadModuleWithDirectory(out_file, dll_name, pre_read);
+ base::FilePath module_dir = GetExecutableDir();
+ *module = module_dir.Append(dll_name);
+ HMODULE dll = LoadModuleWithDirectory(*module, pre_read);
if (!dll) {
base::string16 version_string(GetCurrentModuleVersion());
if (version_string.empty()) {
LOG(ERROR) << "No valid Chrome version found";
return nullptr;
}
- *out_file = executable_dir;
*version = version_string;
- out_file->append(version_string).append(1, L'\\');
- dll = LoadModuleWithDirectory(out_file, dll_name, pre_read);
+ *module = module_dir.Append(version_string).Append(dll_name);
+ dll = LoadModuleWithDirectory(*module, pre_read);
if (!dll) {
- PLOG(ERROR) << "Failed to load Chrome DLL from " << *out_file;
+ PLOG(ERROR) << "Failed to load Chrome DLL from " << module->value();
return nullptr;
}
}
@@ -172,7 +164,7 @@ int MainDllLoader::Launch(HINSTANCE instance) {
process_type_ = cmd_line.GetSwitchValueASCII(switches::kProcessType);
base::string16 version;
- base::string16 file;
+ base::FilePath file;
if (metro_mode_) {
HMODULE metro_dll = Load(&version, &file);
@@ -249,13 +241,12 @@ void MainDllLoader::RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
class ChromeDllLoader : public MainDllLoader {
protected:
void OnBeforeLaunch(const std::string& process_type,
- const base::string16& dll_path) override;
- int OnBeforeExit(int return_code,
- const base::string16& dll_path) override;
+ const base::FilePath& dll_path) override;
+ int OnBeforeExit(int return_code, const base::FilePath& dll_path) override;
};
void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
- const base::string16& dll_path) {
+ const base::FilePath& dll_path) {
if (process_type.empty()) {
RecordDidRun(dll_path);
@@ -274,7 +265,7 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
}
int ChromeDllLoader::OnBeforeExit(int return_code,
- const base::string16& dll_path) {
+ const base::FilePath& dll_path) {
// NORMAL_EXIT_CANCEL is used for experiments when the user cancels
// so we need to reset the did_run signal so omaha does not count
// this run as active usage.
@@ -289,10 +280,8 @@ int ChromeDllLoader::OnBeforeExit(int return_code,
class ChromiumDllLoader : public MainDllLoader {
protected:
void OnBeforeLaunch(const std::string& process_type,
- const base::string16& dll_path) override {
- }
- int OnBeforeExit(int return_code,
- const base::string16& dll_path) override {
+ const base::FilePath& dll_path) override {}
+ int OnBeforeExit(int return_code, const base::FilePath& dll_path) override {
return return_code;
}
};
diff --git a/chrome/app/client_util.h b/chrome/app/client_util.h
index 821be93..de09a66 100644
--- a/chrome/app/client_util.h
+++ b/chrome/app/client_util.h
@@ -17,9 +17,6 @@ namespace sandbox {
struct SandboxInterfaceInfo;
}
-// Gets the path of the current exe with a trailing backslash.
-base::string16 GetExecutablePath();
-
// Returns the version in the current module's version resource or the empty
// string if none found.
base::string16 GetCurrentModuleVersion();
@@ -49,15 +46,18 @@ class MainDllLoader {
// "renderer", "watcher", etc.
// |dll_path| refers to the path of the Chrome dll being loaded.
virtual void OnBeforeLaunch(const std::string& process_type,
- const base::string16& dll_path) = 0;
+ const base::FilePath& dll_path) = 0;
// Called after the chrome.dll entry point returns and before terminating
// this process. The return value will be used as the process return code.
// |dll_path| refers to the path of the Chrome dll being loaded.
- virtual int OnBeforeExit(int return_code, const base::string16& dll_path) = 0;
+ virtual int OnBeforeExit(int return_code, const base::FilePath& dll_path) = 0;
private:
- HMODULE Load(base::string16* version, base::string16* out_file);
+ // Loads chrome.dll, populating |version| with the version of the DLL loaded
+ // and |module| with the path of the loaded DLL. Returns a reference to the
+ // module, or null on failure.
+ HMODULE Load(base::string16* version, base::FilePath* module);
private:
HMODULE dll_;
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc
index 19c7262..7b09d86 100644
--- a/chrome/browser/diagnostics/recon_diagnostics.cc
+++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -143,7 +143,7 @@ class InstallTypeTest : public DiagnosticsTest {
RecordFailure(DIAG_RECON_INSTALL_PATH_PROVIDER, "Path provider failure");
return false;
}
- user_level_ = InstallUtil::IsPerUserInstall(chrome_exe.value().c_str());
+ user_level_ = InstallUtil::IsPerUserInstall(chrome_exe);
const char* type = user_level_ ? "User Level" : "System Level";
std::string install_type(type);
#else
diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc
index ee53047..d11e4f9 100644
--- a/chrome/browser/first_run/first_run_internal_win.cc
+++ b/chrome/browser/first_run/first_run_internal_win.cc
@@ -129,7 +129,7 @@ void DoPostImportPlatformSpecificTasks(Profile* /* profile */) {
base::FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
NOTREACHED();
- } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) {
+ } else if (!InstallUtil::IsPerUserInstall(chrome_exe)) {
content::BrowserThread::GetBlockingPool()->PostDelayedTask(
FROM_HERE,
base::Bind(&InstallUtil::TriggerActiveSetupCommand),
@@ -146,7 +146,7 @@ bool IsFirstRunSentinelPresent() {
// from the application directory to the user data directory.
base::FilePath exe_path;
if (PathService::Get(base::DIR_EXE, &exe_path) &&
- InstallUtil::IsPerUserInstall(exe_path.value().c_str())) {
+ InstallUtil::IsPerUserInstall(exe_path)) {
base::FilePath legacy_sentinel = exe_path.Append(chrome::kFirstRunSentinel);
if (base::PathExists(legacy_sentinel)) {
// Copy the file instead of moving it to avoid breaking developer builds
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index 1a489a8..fe4861b 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -247,8 +247,7 @@ bool SwapNewChromeExeIfPresent() {
return false;
// Open up the registry key containing current version and rename information.
- bool user_install =
- InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str());
+ bool user_install = InstallUtil::IsPerUserInstall(cur_chrome_exe);
HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
BrowserDistribution *dist = BrowserDistribution::GetDistribution();
base::win::RegKey key;
diff --git a/chrome/browser/google/did_run_updater_win.cc b/chrome/browser/google/did_run_updater_win.cc
index b409fd0..09bd417 100644
--- a/chrome/browser/google/did_run_updater_win.cc
+++ b/chrome/browser/google/did_run_updater_win.cc
@@ -17,7 +17,7 @@
DidRunUpdater::DidRunUpdater() : system_level_(false) {
base::FilePath exe_path;
if (PathService::Get(base::FILE_EXE, &exe_path))
- system_level_ = !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
+ system_level_ = !InstallUtil::IsPerUserInstall(exe_path);
registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
content::NotificationService::AllSources());
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc
index 69ac3ac6..f15b7a3 100644
--- a/chrome/browser/google/google_update_win.cc
+++ b/chrome/browser/google/google_update_win.cc
@@ -41,8 +41,7 @@ GoogleUpdateErrorCode CanUpdateCurrentChrome(
#if !defined(GOOGLE_CHROME_BUILD)
return CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY;
#else
- DCHECK_NE(InstallUtil::IsPerUserInstall(chrome_exe_path.value().c_str()),
- system_level);
+ DCHECK_NE(InstallUtil::IsPerUserInstall(chrome_exe_path), system_level);
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::FilePath user_exe_path = installer::GetChromeInstallPath(false, dist);
base::FilePath machine_exe_path = installer::GetChromeInstallPath(true, dist);
@@ -405,8 +404,7 @@ bool UpdateCheckDriver::BeginUpdateCheckInternal(
if (!PathService::Get(base::DIR_EXE, &chrome_exe))
NOTREACHED();
- const bool system_level =
- !InstallUtil::IsPerUserInstall(chrome_exe.value().c_str());
+ const bool system_level = !InstallUtil::IsPerUserInstall(chrome_exe);
// The failures handled here are:
// CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY,
diff --git a/chrome/browser/metrics/variations/variations_registry_syncer_win.cc b/chrome/browser/metrics/variations/variations_registry_syncer_win.cc
index dcfd5e2..307d1cc 100644
--- a/chrome/browser/metrics/variations/variations_registry_syncer_win.cc
+++ b/chrome/browser/metrics/variations/variations_registry_syncer_win.cc
@@ -33,8 +33,7 @@ void SyncWithRegistryOnBlockingPool() {
NOTREACHED() << "Failed to get chrome exe path";
return;
}
- const bool is_system_install =
- !InstallUtil::IsPerUserInstall(chrome_exe.value().c_str());
+ const bool is_system_install = !InstallUtil::IsPerUserInstall(chrome_exe);
// Read the current bits from the registry.
base::string16 registry_labels;
diff --git a/chrome/browser/metro_utils/metro_chrome_win.cc b/chrome/browser/metro_utils/metro_chrome_win.cc
index d20a680..96e84ac 100644
--- a/chrome/browser/metro_utils/metro_chrome_win.cc
+++ b/chrome/browser/metro_utils/metro_chrome_win.cc
@@ -30,9 +30,9 @@ bool ActivateMetroChrome() {
return false;
}
- base::string16 app_id = ShellUtil::GetBrowserModelId(
- BrowserDistribution::GetDistribution(),
- InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()));
+ base::string16 app_id =
+ ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(),
+ InstallUtil::IsPerUserInstall(chrome_exe));
if (app_id.empty()) {
NOTREACHED() << "Failed to get chrome app user model id.";
return false;
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 614167a..8516cc3 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -267,8 +267,8 @@ bool ShellIntegration::SetAsDefaultBrowser() {
// From UI currently we only allow setting default browser for current user.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (!ShellUtil::MakeChromeDefault(dist, ShellUtil::CURRENT_USER,
- chrome_exe.value(), true)) {
+ if (!ShellUtil::MakeChromeDefault(dist, ShellUtil::CURRENT_USER, chrome_exe,
+ true /* elevate_if_not_admin */)) {
LOG(ERROR) << "Chrome could not be set as default browser.";
return false;
}
@@ -289,8 +289,8 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) {
base::string16 wprotocol(base::UTF8ToUTF16(protocol));
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (!ShellUtil::MakeChromeDefaultProtocolClient(dist, chrome_exe.value(),
- wprotocol)) {
+ if (!ShellUtil::MakeChromeDefaultProtocolClient(dist, chrome_exe,
+ wprotocol)) {
LOG(ERROR) << "Chrome could not be set as default handler for "
<< protocol << ".";
return false;
@@ -308,7 +308,7 @@ bool ShellIntegration::SetAsDefaultBrowserInteractive() {
}
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe.value())) {
+ if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe)) {
LOG(ERROR) << "Failed to launch the set-default-browser Windows UI.";
return false;
}
@@ -327,8 +327,8 @@ bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::string16 wprotocol(base::UTF8ToUTF16(protocol));
- if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
- dist, chrome_exe.value(), wprotocol)) {
+ if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(dist, chrome_exe,
+ wprotocol)) {
LOG(ERROR) << "Failed to launch the set-default-client Windows UI.";
return false;
}
@@ -411,8 +411,8 @@ base::string16 ShellIntegration::GetChromiumModelIdForProfile(
return dist->GetBaseAppId();
}
return GetAppModelIdForProfile(
- ShellUtil::GetBrowserModelId(
- dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())),
+ ShellUtil::GetBrowserModelId(dist,
+ InstallUtil::IsPerUserInstall(chrome_exe)),
profile_path);
}
@@ -447,8 +447,7 @@ int ShellIntegration::MigrateShortcutsInPathInternal(
path, false, // not recursive
base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk"));
- bool is_per_user_install =
- InstallUtil::IsPerUserInstall(chrome_exe.value().c_str());
+ bool is_per_user_install = InstallUtil::IsPerUserInstall(chrome_exe);
int shortcuts_migrated = 0;
base::FilePath target_path;
@@ -568,8 +567,7 @@ base::FilePath ShellIntegration::GetStartMenuShortcut(
// Check both the common and the per-user Start Menu folders for system-level
// installs.
- size_t folder =
- InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()) ? 1 : 0;
+ size_t folder = InstallUtil::IsPerUserInstall(chrome_exe) ? 1 : 0;
for (; folder < arraysize(kFolderIds); ++folder) {
if (!PathService::Get(kFolderIds[folder], &shortcut)) {
NOTREACHED();
diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
index 0a57cfc..6f26c49 100644
--- a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
+++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
@@ -141,8 +141,7 @@ void SetDidRunForNDayActiveStats() {
NOTREACHED();
return;
}
- bool system_install =
- !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
+ bool system_install = !InstallUtil::IsPerUserInstall(exe_path);
// Using Chrome Binary dist: Chrome dist may not exist for the legacy
// App Launcher, and App Launcher dist may be "shadow", which does not
// contain the information needed to determine multi-install.
diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc
index 108f3ab..5b52b06 100644
--- a/chrome/browser/upgrade_detector_impl.cc
+++ b/chrome/browser/upgrade_detector_impl.cc
@@ -122,7 +122,7 @@ bool IsSystemInstall() {
return false;
}
- return !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
+ return !InstallUtil::IsPerUserInstall(exe_path);
}
// Sets |is_unstable_channel| to true if the current chrome is on the dev or
diff --git a/chrome/common/chrome_version_info_win.cc b/chrome/common/chrome_version_info_win.cc
index d692c5e..4d87a80 100644
--- a/chrome/common/chrome_version_info_win.cc
+++ b/chrome/common/chrome_version_info_win.cc
@@ -26,9 +26,7 @@ std::string VersionInfo::GetVersionStringModifier() {
base::FilePath module;
base::string16 channel;
if (PathService::Get(base::FILE_MODULE, &module)) {
- bool is_system_install =
- !InstallUtil::IsPerUserInstall(module.value().c_str());
-
+ bool is_system_install = !InstallUtil::IsPerUserInstall(module);
GoogleUpdateSettings::GetChromeChannelAndModifiers(is_system_install,
&channel);
}
@@ -49,8 +47,7 @@ VersionInfo::Channel VersionInfo::GetChannel() {
base::FilePath module;
if (PathService::Get(base::FILE_MODULE, &module)) {
- bool is_system_install =
- !InstallUtil::IsPerUserInstall(module.value().c_str());
+ bool is_system_install = !InstallUtil::IsPerUserInstall(module);
channel = GoogleUpdateSettings::GetChromeChannel(is_system_install);
}
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 95632fa..f4c091b 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -469,9 +469,9 @@ void RegisterChromeOnMachine(const installer::InstallerState& installer_state,
// Make Chrome the default browser if desired when possible. Otherwise, only
// register it with Windows.
BrowserDistribution* dist = product.distribution();
- const base::string16 chrome_exe(
- installer_state.target_path().Append(installer::kChromeExe).value());
- VLOG(1) << "Registering Chrome as browser: " << chrome_exe;
+ const base::FilePath chrome_exe(
+ installer_state.target_path().Append(installer::kChromeExe));
+ VLOG(1) << "Registering Chrome as browser: " << chrome_exe.value();
if (make_chrome_default && ShellUtil::CanMakeChromeDefaultUnattended()) {
int level = ShellUtil::CURRENT_USER;
if (installer_state.system_install())
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index cca3132..e76a5dd 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -752,7 +752,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
BrowserDistribution* dist = product.distribution();
base::string16 chrome_icon = ShellUtil::FormatIconLocation(
- install_path.Append(dist->GetIconFilename()).value(),
+ install_path.Append(dist->GetIconFilename()),
dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME));
install_list->AddSetRegValueWorkItem(reg_root,
uninstall_reg,
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 86ce7a2..0acc5fc 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -872,8 +872,8 @@ bool CreateEULASentinel(BrowserDistribution* dist) {
void ActivateMetroChrome() {
// Check to see if we're per-user or not. Need to do this since we may
// not have been invoked with --system-level even for a machine install.
- wchar_t exe_path[MAX_PATH * 2] = {};
- GetModuleFileName(NULL, exe_path, arraysize(exe_path));
+ base::FilePath exe_path;
+ PathService::Get(base::FILE_EXE, &exe_path);
bool is_per_user_install = InstallUtil::IsPerUserInstall(exe_path);
base::string16 app_model_id = ShellUtil::GetBrowserModelId(
@@ -953,10 +953,10 @@ installer::InstallStatus RegisterDevChrome(
delegate_execute_list.get());
delegate_execute_list->Do();
if (ShellUtil::CanMakeChromeDefaultUnattended()) {
- ShellUtil::MakeChromeDefault(
- chrome_dist, ShellUtil::CURRENT_USER, chrome_exe.value(), true);
+ ShellUtil::MakeChromeDefault(chrome_dist, ShellUtil::CURRENT_USER,
+ chrome_exe, true);
} else {
- ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe.value());
+ ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe);
}
} else {
LOG(ERROR) << "Path not found: " << chrome_exe.value();
@@ -1077,7 +1077,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
// These options should only be used when setup.exe is launched with admin
// rights. We do not make any user specific changes with this option.
DCHECK(IsUserAnAdmin());
- base::string16 chrome_exe(cmd_line.GetSwitchValueNative(
+ base::FilePath chrome_exe(cmd_line.GetSwitchValuePath(
installer::switches::kRegisterChromeBrowser));
base::string16 suffix;
if (cmd_line.HasSwitch(
@@ -1569,7 +1569,7 @@ InstallStatus InstallProductsHelper(
*installer_version);
int install_msg_base = IDS_INSTALL_FAILED_BASE;
- base::string16 chrome_exe;
+ base::FilePath chrome_exe;
base::string16 quoted_chrome_exe;
if (install_status == SAME_VERSION_REPAIR_FAILED) {
install_msg_base = IDS_SAME_VERSION_REPAIR_FAILED_BASE;
@@ -1580,8 +1580,8 @@ InstallStatus InstallProductsHelper(
install_msg_base = IDS_INSTALL_OS_ERROR_BASE;
install_status = OS_ERROR;
} else {
- chrome_exe = installer_state.target_path().Append(kChromeExe).value();
- quoted_chrome_exe = L"\"" + chrome_exe + L"\"";
+ chrome_exe = installer_state.target_path().Append(kChromeExe);
+ quoted_chrome_exe = L"\"" + chrome_exe.value() + L"\"";
install_msg_base = 0;
}
}
@@ -1625,7 +1625,7 @@ InstallStatus InstallProductsHelper(
const Product* chrome = installer_state.FindProduct(
BrowserDistribution::CHROME_BROWSER);
if (chrome != NULL) {
- DCHECK_NE(chrome_exe, base::string16());
+ DCHECK_NE(chrome_exe.value(), base::string16());
RemoveChromeLegacyRegistryKeys(chrome->distribution(), chrome_exe);
}
}
@@ -1753,10 +1753,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// extension), in which case CommandLineToArgv will not yield an argv with the
// true path to the program at position 0.
base::FilePath setup_exe;
- if (!PathService::Get(base::FILE_EXE, &setup_exe)) {
- NOTREACHED();
- return installer::OS_ERROR;
- }
+ PathService::Get(base::FILE_EXE, &setup_exe);
int exit_code = 0;
if (HandleNonInstallCmdLineOptions(
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 0d8293f..0eb961a 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -1046,7 +1046,7 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state,
}
void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
// We used to register Chrome to handle crx files, but this turned out
// to be not worth the hassle. Remove these old registry entries if
// they exist. See: http://codereview.chromium.org/210007
@@ -1097,8 +1097,8 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
const CommandLine& cmd_line) {
InstallStatus status = installer::UNINSTALL_CONFIRMED;
BrowserDistribution* browser_dist = product.distribution();
- const base::string16 chrome_exe(
- installer_state.target_path().Append(installer::kChromeExe).value());
+ const base::FilePath chrome_exe(
+ installer_state.target_path().Append(installer::kChromeExe));
bool is_chrome = product.is_chrome();
@@ -1173,15 +1173,14 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
Append(installer::kChromeExe));
VLOG(1) << "Retargeting user-generated Chrome shortcuts.";
if (base::PathExists(system_chrome_path)) {
- RetargetUserShortcutsWithArgs(installer_state, product,
- base::FilePath(chrome_exe),
+ RetargetUserShortcutsWithArgs(installer_state, product, chrome_exe,
system_chrome_path);
} else {
LOG(ERROR) << "Retarget failed: system-level Chrome not found.";
}
}
- DeleteShortcuts(installer_state, product, base::FilePath(chrome_exe));
+ DeleteShortcuts(installer_state, product, chrome_exe);
}
// Delete the registry keys (Uninstall key and Version key).
@@ -1270,7 +1269,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
UninstallActiveSetupEntries(installer_state, product);
- UninstallFirewallRules(browser_dist, base::FilePath(chrome_exe));
+ UninstallFirewallRules(browser_dist, chrome_exe);
RemoveBlacklistState();
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h
index 2c9151c..58abff6 100644
--- a/chrome/installer/setup/uninstall.h
+++ b/chrome/installer/setup/uninstall.h
@@ -53,7 +53,7 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state,
// longer needed. This is used during autoupdate since we don't do full
// uninstalls/reinstalls to update.
void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist,
- const base::string16& chrome_exe);
+ const base::FilePath& chrome_exe);
// This function uninstalls a product. Hence we came up with this awesome
// name for it.
diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc
index 5f2a262..1b7bd00 100644
--- a/chrome/installer/util/chrome_browser_operations.cc
+++ b/chrome/installer/util/chrome_browser_operations.cc
@@ -128,8 +128,7 @@ void ChromeBrowserOperations::AddDefaultShortcutProperties(
}
if (!properties->has_app_id()) {
- bool is_per_user_install =
- InstallUtil::IsPerUserInstall(target_exe.value().c_str());
+ bool is_per_user_install = InstallUtil::IsPerUserInstall(target_exe);
properties->set_app_id(
ShellUtil::GetBrowserModelId(dist, is_per_user_install));
}
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 2bcd470..7b2fbc3 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -214,7 +214,7 @@ bool GoogleUpdateSettings::IsSystemInstall() {
LOG(WARNING)
<< "Failed to get directory of module; assuming per-user install.";
} else {
- system_install = !InstallUtil::IsPerUserInstall(module_dir.value().c_str());
+ system_install = !InstallUtil::IsPerUserInstall(module_dir);
}
return system_install;
}
diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc
index db07f84..efe5835 100644
--- a/chrome/installer/util/google_update_util.cc
+++ b/chrome/installer/util/google_update_util.cc
@@ -155,8 +155,7 @@ void ElevateIfNeededToReenableUpdates() {
}
installer::ProductState product_state;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- const bool system_install = !InstallUtil::IsPerUserInstall(
- chrome_exe.value().c_str());
+ const bool system_install = !InstallUtil::IsPerUserInstall(chrome_exe);
if (!product_state.Initialize(system_install, dist))
return;
base::FilePath exe_path(product_state.GetSetupPath());
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 22905ef..e81c0cc 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -363,7 +363,7 @@ void InstallUtil::UpdateInstallerStage(bool system_install,
}
}
-bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) {
+bool InstallUtil::IsPerUserInstall(const base::FilePath& exe_path) {
const int kProgramFilesKey =
#if defined(_WIN64)
// TODO(wfh): Revise this when Chrome is/can be installed in the 64-bit
@@ -377,7 +377,7 @@ bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) {
NOTREACHED();
return true;
}
- return !StartsWith(exe_path, program_files_path.value().c_str(), false);
+ return !StartsWith(exe_path.value(), program_files_path.value(), false);
}
bool InstallUtil::IsMultiInstall(BrowserDistribution* dist,
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index bf3e542..2d4e7d7 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -91,10 +91,10 @@ class InstallUtil {
const base::string16& state_key_path,
installer::InstallerStage stage);
- // Returns true if this installation path is per user, otherwise returns
- // false (per machine install, meaning: the exe_path contains path to
- // Program Files).
- static bool IsPerUserInstall(const wchar_t* const exe_path);
+ // Returns true if this installation path is per user, otherwise returns false
+ // (per machine install, meaning: the exe_path contains the path to Program
+ // Files).
+ static bool IsPerUserInstall(const base::FilePath& exe_path);
// Returns true if the installation represented by the pair of |dist| and
// |system_level| is a multi install.
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc
index 567e0c1..238148f 100644
--- a/chrome/installer/util/install_util_unittest.cc
+++ b/chrome/installer/util/install_util_unittest.cc
@@ -474,7 +474,7 @@ TEST_F(InstallUtilTest, IsPerUserInstall) {
some_exe = some_exe.AppendASCII("Company")
.AppendASCII("Product")
.AppendASCII("product.exe");
- EXPECT_FALSE(InstallUtil::IsPerUserInstall(some_exe.value().c_str()));
+ EXPECT_FALSE(InstallUtil::IsPerUserInstall(some_exe));
#if defined(_WIN64)
const int kOtherProgramFilesKey = base::DIR_PROGRAM_FILES;
@@ -483,6 +483,6 @@ TEST_F(InstallUtilTest, IsPerUserInstall) {
some_exe = some_exe.AppendASCII("Company")
.AppendASCII("Product")
.AppendASCII("product.exe");
- EXPECT_TRUE(InstallUtil::IsPerUserInstall(some_exe.value().c_str()));
+ EXPECT_TRUE(InstallUtil::IsPerUserInstall(some_exe));
#endif // defined(_WIN64)
}
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index bf77fda..22261c1 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -204,8 +204,7 @@ class RegistryEntry {
// are NOT the name/icon that will represent the application under the Open
// With menu.)
base::string16 file_type_name;
- // TODO(mgiuca): |file_type_icon_path| should be a base::FilePath.
- base::string16 file_type_icon_path;
+ base::FilePath file_type_icon_path;
int file_type_icon_index;
// The command to execute when opening a file via this association. It
// should contain "%1" (to tell Windows to pass the filename as an
@@ -218,8 +217,7 @@ class RegistryEntry {
// User-visible details about this application. Any of these may be empty.
base::string16 application_name;
- // TODO(mgiuca): |application_icon_path| should be a base::FilePath.
- base::string16 application_icon_path;
+ base::FilePath application_icon_path;
int application_icon_index;
base::string16 application_description;
base::string16 publisher_name;
@@ -256,7 +254,7 @@ class RegistryEntry {
// are needed to register this installation's ProgId and AppId.
// These entries need to be registered in HKLM prior to Win8.
static void GetChromeProgIdEntries(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
ScopedVector<RegistryEntry>* entries) {
int chrome_icon_index =
@@ -272,7 +270,7 @@ class RegistryEntry {
// For user-level installs: entries for the app id will be in HKCU; thus we
// do not need a suffix on those entries.
app_info.app_id = ShellUtil::GetBrowserModelId(
- dist, InstallUtil::IsPerUserInstall(chrome_exe.c_str()));
+ dist, InstallUtil::IsPerUserInstall(chrome_exe));
// The command to execute when opening this application via the Metro UI.
base::string16 delegate_command(
@@ -431,14 +429,14 @@ class RegistryEntry {
// If |suffix| is not empty, these entries are guaranteed to be unique on this
// machine.
static void GetShellIntegrationEntries(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
ScopedVector<RegistryEntry>* entries) {
const base::string16 icon_path(
ShellUtil::FormatIconLocation(
chrome_exe,
dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)));
- const base::string16 quoted_exe_path(L"\"" + chrome_exe + L"\"");
+ const base::string16 quoted_exe_path(L"\"" + chrome_exe.value() + L"\"");
// Register for the Start Menu "Internet" link (pre-Win7).
const base::string16 start_menu_entry(GetBrowserClientKey(dist, suffix));
@@ -513,16 +511,16 @@ class RegistryEntry {
// http://msdn.microsoft.com/en-us/library/bb166549
// These entries need to be registered in HKLM prior to Win8.
static void GetChromeAppRegistrationEntries(
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
ScopedVector<RegistryEntry>* entries) {
- const base::FilePath chrome_path(chrome_exe);
base::string16 app_path_key(ShellUtil::kAppPathsRegistryKey);
app_path_key.push_back(base::FilePath::kSeparators[0]);
- app_path_key.append(chrome_path.BaseName().value());
- entries->push_back(new RegistryEntry(app_path_key, chrome_exe));
+ app_path_key.append(chrome_exe.BaseName().value());
+ entries->push_back(new RegistryEntry(app_path_key, chrome_exe.value()));
entries->push_back(new RegistryEntry(app_path_key,
- ShellUtil::kAppPathsRegistryPathName, chrome_path.DirName().value()));
+ ShellUtil::kAppPathsRegistryPathName,
+ chrome_exe.DirName().value()));
const base::string16 html_prog_id(GetBrowserProgId(suffix));
for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) {
@@ -620,7 +618,7 @@ class RegistryEntry {
// values.
static void GetXPStyleDefaultBrowserUserEntries(
BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
ScopedVector<RegistryEntry>* entries) {
// File extension associations.
@@ -807,7 +805,7 @@ bool AreEntriesRegistered(const ScopedVector<RegistryEntry>& entries,
// true for affected users (i.e. who have all the registrations, but over both
// registry roots).
bool IsChromeRegistered(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
uint32 look_for_in) {
ScopedVector<RegistryEntry> entries;
@@ -836,17 +834,16 @@ bool IsChromeRegisteredForProtocol(BrowserDistribution* dist,
// If protocol is non-empty we will also register Chrome as being capable of
// handling the protocol.
bool ElevateAndRegisterChrome(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
const base::string16& protocol) {
// Only user-level installs prior to Windows 8 should need to elevate to
// register.
- DCHECK(InstallUtil::IsPerUserInstall(chrome_exe.c_str()));
+ DCHECK(InstallUtil::IsPerUserInstall(chrome_exe));
DCHECK_LT(base::win::GetVersion(), base::win::VERSION_WIN8);
- base::FilePath exe_path =
- base::FilePath(chrome_exe).DirName().Append(installer::kSetupExe);
+ base::FilePath exe_path = chrome_exe.DirName().Append(installer::kSetupExe);
if (!base::PathExists(exe_path)) {
- HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ?
+ HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe) ?
HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
RegKey key(reg_root,
dist->GetUninstallRegPath().c_str(),
@@ -859,8 +856,8 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist,
if (base::PathExists(exe_path)) {
CommandLine cmd(exe_path);
- cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser,
- chrome_exe);
+ cmd.AppendSwitchPath(installer::switches::kRegisterChromeBrowser,
+ chrome_exe);
if (!suffix.empty()) {
cmd.AppendSwitchNative(
installer::switches::kRegisterChromeBrowserSuffix, suffix);
@@ -923,7 +920,7 @@ bool LaunchApplicationAssociationDialog(const base::string16& app_id) {
// how Chrome is registered, not to know whether the registration is complete
// at install-time (IsChromeRegistered() can be used for that).
bool QuickIsChromeRegistered(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix,
RegistrationConfirmationLevel confirmation_level) {
// Get the appropriate key to look for based on the level desired.
@@ -957,19 +954,15 @@ bool QuickIsChromeRegistered(BrowserDistribution* dist,
base::string16 hkcu_value;
// If |reg_key| is present in HKCU, assert that it points to |chrome_exe|.
// Otherwise, fall back on an HKLM lookup below.
- if (key_hkcu.ReadValue(L"", &hkcu_value) == ERROR_SUCCESS) {
- return InstallUtil::ProgramCompare(
- base::FilePath(chrome_exe)).Evaluate(hkcu_value);
- }
+ if (key_hkcu.ReadValue(L"", &hkcu_value) == ERROR_SUCCESS)
+ return InstallUtil::ProgramCompare(chrome_exe).Evaluate(hkcu_value);
}
// Assert that |reg_key| points to |chrome_exe| in HKLM.
const RegKey key_hklm(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_QUERY_VALUE);
base::string16 hklm_value;
- if (key_hklm.ReadValue(L"", &hklm_value) == ERROR_SUCCESS) {
- return InstallUtil::ProgramCompare(
- base::FilePath(chrome_exe)).Evaluate(hklm_value);
- }
+ if (key_hklm.ReadValue(L"", &hklm_value) == ERROR_SUCCESS)
+ return InstallUtil::ProgramCompare(chrome_exe).Evaluate(hklm_value);
return false;
}
@@ -984,9 +977,9 @@ bool QuickIsChromeRegistered(BrowserDistribution* dist,
// with other Chrome user-level installs.
// Returns true unless one of the underlying calls fails.
bool GetInstallationSpecificSuffix(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
base::string16* suffix) {
- if (!InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ||
+ if (!InstallUtil::IsPerUserInstall(chrome_exe) ||
QuickIsChromeRegistered(dist, chrome_exe, base::string16(),
CONFIRM_SHELL_REGISTRATION)) {
// No suffix on system-level installs and user-level installs already
@@ -1022,7 +1015,7 @@ HKEY DetermineRegistrationRoot(bool is_per_user) {
// Software\Classes\http key directly, we have to do this on Vista+ as well.
bool RegisterChromeAsDefaultXPStyle(BrowserDistribution* dist,
int shell_change,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
bool ret = true;
ScopedVector<RegistryEntry> entries;
RegistryEntry::GetXPStyleDefaultBrowserUserEntries(
@@ -1052,7 +1045,7 @@ bool RegisterChromeAsDefaultXPStyle(BrowserDistribution* dist,
// See http://msdn.microsoft.com/library/aa767914.aspx for more details.
bool RegisterChromeAsDefaultProtocolClientXPStyle(
BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& protocol) {
ScopedVector<RegistryEntry> entries;
const base::string16 chrome_open(
@@ -1147,9 +1140,9 @@ base::win::ShortcutProperties TranslateShortcutProperties(
// Cleans up an old verb (run) we used to register in
// <root>\Software\Classes\Chrome<.suffix>\.exe\shell\run on Windows 8.
void RemoveRunVerbOnWindows8(BrowserDistribution* dist,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
if (IsChromeMetroSupported()) {
- bool is_per_user_install =InstallUtil::IsPerUserInstall(chrome_exe.c_str());
+ bool is_per_user_install = InstallUtil::IsPerUserInstall(chrome_exe);
HKEY root_key = DetermineRegistrationRoot(is_per_user_install);
// There's no need to rollback, so forgo the usual work item lists and just
// remove the key from the registry.
@@ -1201,7 +1194,7 @@ ShellUtil::DefaultState ProbeCurrentDefaultHandlers(
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::string16 prog_id(dist->GetBrowserProgIdPrefix());
- prog_id += ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe.value());
+ prog_id += ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe);
for (size_t i = 0; i < num_protocols; ++i) {
base::win::ScopedCoMem<wchar_t> current_app;
@@ -1227,8 +1220,7 @@ ShellUtil::DefaultState ProbeAppIsDefaultHandlers(
return ShellUtil::UNKNOWN_DEFAULT;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- base::string16 app_name(
- ShellUtil::GetApplicationName(dist, chrome_exe.value()));
+ base::string16 app_name(ShellUtil::GetApplicationName(dist, chrome_exe));
BOOL result;
for (size_t i = 0; i < num_protocols; ++i) {
@@ -1576,7 +1568,7 @@ const wchar_t* ShellUtil::kRegDelegateExecute = L"DelegateExecute";
const wchar_t* ShellUtil::kRegOpenWithProgids = L"OpenWithProgids";
bool ShellUtil::QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix) {
return QuickIsChromeRegistered(dist, chrome_exe, suffix,
CONFIRM_SHELL_REGISTRATION_IN_HKLM);
@@ -1753,22 +1745,22 @@ bool ShellUtil::CreateOrUpdateShortcut(
return ret;
}
-base::string16 ShellUtil::FormatIconLocation(const base::string16& icon_path,
+base::string16 ShellUtil::FormatIconLocation(const base::FilePath& icon_path,
int icon_index) {
- base::string16 icon_string(icon_path);
+ base::string16 icon_string(icon_path.value());
icon_string.append(L",");
icon_string.append(base::IntToString16(icon_index));
return icon_string;
}
base::string16 ShellUtil::GetChromeShellOpenCmd(
- const base::string16& chrome_exe) {
- return L"\"" + chrome_exe + L"\" -- \"%1\"";
+ const base::FilePath& chrome_exe) {
+ return L"\"" + chrome_exe.value() + L"\" -- \"%1\"";
}
base::string16 ShellUtil::GetChromeDelegateCommand(
- const base::string16& chrome_exe) {
- return L"\"" + chrome_exe + L"\" -- %*";
+ const base::FilePath& chrome_exe) {
+ return L"\"" + chrome_exe.value() + L"\" -- %*";
}
void ShellUtil::GetRegisteredBrowsers(
@@ -1812,7 +1804,7 @@ void ShellUtil::GetRegisteredBrowsers(
base::string16 ShellUtil::GetCurrentInstallationSuffix(
BrowserDistribution* dist,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
// This method is somewhat the opposite of GetInstallationSpecificSuffix().
// In this case we are not trying to determine the current suffix for the
// upcoming installation (i.e. not trying to stick to a currently bad
@@ -1823,7 +1815,7 @@ base::string16 ShellUtil::GetCurrentInstallationSuffix(
// 2) Username (old-style).
// 3) Unsuffixed (even worse).
base::string16 tested_suffix;
- if (InstallUtil::IsPerUserInstall(chrome_exe.c_str()) &&
+ if (InstallUtil::IsPerUserInstall(chrome_exe) &&
(!GetUserSpecificRegistrySuffix(&tested_suffix) ||
!QuickIsChromeRegistered(dist, chrome_exe, tested_suffix,
CONFIRM_PROGID_REGISTRATION)) &&
@@ -1841,7 +1833,7 @@ base::string16 ShellUtil::GetCurrentInstallationSuffix(
}
base::string16 ShellUtil::GetApplicationName(BrowserDistribution* dist,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
base::string16 app_name = dist->GetBaseAppName();
app_name += GetCurrentInstallationSuffix(dist, chrome_exe);
return app_name;
@@ -1975,7 +1967,7 @@ bool ShellUtil::CanMakeChromeDefaultUnattended() {
bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
int shell_change,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
bool elevate_if_not_admin) {
DCHECK(!(shell_change & ShellUtil::SYSTEM_LEVEL) || IsUserAnAdmin());
@@ -2045,7 +2037,7 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
bool ShellUtil::ShowMakeChromeDefaultSystemUI(
BrowserDistribution* dist,
- const base::string16& chrome_exe) {
+ const base::FilePath& chrome_exe) {
DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN8);
if (dist->GetDefaultBrowserControlPolicy() !=
BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) {
@@ -2074,7 +2066,7 @@ bool ShellUtil::ShowMakeChromeDefaultSystemUI(
bool ShellUtil::MakeChromeDefaultProtocolClient(
BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& protocol) {
if (dist->GetDefaultBrowserControlPolicy() !=
BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL) {
@@ -2123,7 +2115,7 @@ bool ShellUtil::MakeChromeDefaultProtocolClient(
bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& protocol) {
DCHECK_GE(base::win::GetVersion(), base::win::VERSION_WIN8);
if (dist->GetDefaultBrowserControlPolicy() !=
@@ -2155,7 +2147,7 @@ bool ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(
}
bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& unique_suffix,
bool elevate_if_not_admin) {
if (dist->GetDefaultBrowserControlPolicy() ==
@@ -2178,7 +2170,7 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist,
RemoveRunVerbOnWindows8(dist, chrome_exe);
- bool user_level = InstallUtil::IsPerUserInstall(chrome_exe.c_str());
+ bool user_level = InstallUtil::IsPerUserInstall(chrome_exe);
HKEY root = DetermineRegistrationRoot(user_level);
// Look only in HKLM for system-level installs (otherwise, if a user-level
@@ -2249,7 +2241,7 @@ bool ShellUtil::RegisterChromeBrowser(BrowserDistribution* dist,
}
bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& unique_suffix,
const base::string16& protocol,
bool elevate_if_not_admin) {
@@ -2265,7 +2257,7 @@ bool ShellUtil::RegisterChromeForProtocol(BrowserDistribution* dist,
return false;
}
- bool user_level = InstallUtil::IsPerUserInstall(chrome_exe.c_str());
+ bool user_level = InstallUtil::IsPerUserInstall(chrome_exe);
HKEY root = DetermineRegistrationRoot(user_level);
// Look only in HKLM for system-level installs (otherwise, if a user-level
@@ -2443,7 +2435,7 @@ bool ShellUtil::AddFileAssociations(
RegistryEntry::ApplicationInfo app_info;
app_info.prog_id = prog_id;
app_info.file_type_name = file_type_name;
- app_info.file_type_icon_path = icon_path.value();
+ app_info.file_type_icon_path = icon_path;
app_info.file_type_icon_index = 0;
app_info.command_line = command_line.GetCommandLineStringWithPlaceholders();
RegistryEntry::GetProgIdEntries(app_info, &entries);
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index 313972a..27e51e4 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -305,7 +305,7 @@ class ShellUtil {
// Note: This only checks one deterministic key in HKLM for |chrome_exe| and
// doesn't otherwise validate a full Chrome install in HKLM.
static bool QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& suffix);
// Returns true if the current Windows version supports the presence of
@@ -338,20 +338,20 @@ class ShellUtil {
// Returns the string "|icon_path|,|icon_index|" (see, for example,
// http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx).
- static base::string16 FormatIconLocation(const base::string16& icon_path,
+ static base::string16 FormatIconLocation(const base::FilePath& icon_path,
int icon_index);
// This method returns the command to open URLs/files using chrome. Typically
// this command is written to the registry under shell\open\command key.
// |chrome_exe|: the full path to chrome.exe
- static base::string16 GetChromeShellOpenCmd(const base::string16& chrome_exe);
+ static base::string16 GetChromeShellOpenCmd(const base::FilePath& chrome_exe);
// This method returns the command to be called by the DelegateExecute verb
// handler to launch chrome on Windows 8. Typically this command is written to
// the registry under the HKCR\Chrome\.exe\shell\(open|run)\command key.
// |chrome_exe|: the full path to chrome.exe
static base::string16 GetChromeDelegateCommand(
- const base::string16& chrome_exe);
+ const base::FilePath& chrome_exe);
// Gets a mapping of all registered browser names (excluding browsers in the
// |dist| distribution) and their reinstall command (which usually sets
@@ -381,7 +381,7 @@ class ShellUtil {
// |chrome_exe| The path to the currently installed (or running) chrome.exe.
static base::string16 GetCurrentInstallationSuffix(
BrowserDistribution* dist,
- const base::string16& chrome_exe);
+ const base::FilePath& chrome_exe);
// Returns the application name of the program under |dist|.
// This application name will be suffixed as is appropriate for the current
@@ -389,7 +389,7 @@ class ShellUtil {
// This is the name that is registered with Default Programs on Windows and
// that should thus be used to "make chrome default" and such.
static base::string16 GetApplicationName(BrowserDistribution* dist,
- const base::string16& chrome_exe);
+ const base::FilePath& chrome_exe);
// Returns the AppUserModelId for |dist|. This identifier is unconditionally
// suffixed with a unique id for this user on user-level installs (in contrast
@@ -443,7 +443,7 @@ class ShellUtil {
// Chrome registration.
static bool MakeChromeDefault(BrowserDistribution* dist,
int shell_change,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
bool elevate_if_not_admin);
// Shows and waits for the Windows 8 "How do you want to open webpages?"
@@ -454,13 +454,13 @@ class ShellUtil {
// |dist| gives the type of browser distribution currently in use.
// |chrome_exe| The chrome.exe path to register as default browser.
static bool ShowMakeChromeDefaultSystemUI(BrowserDistribution* dist,
- const base::string16& chrome_exe);
+ const base::FilePath& chrome_exe);
// Make Chrome the default application for a protocol.
// chrome_exe: The chrome.exe path to register as default browser.
// protocol: The protocol to register as the default handler for.
static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& protocol);
// Shows and waits for the Windows 8 "How do you want to open links of this
@@ -473,7 +473,7 @@ class ShellUtil {
// |protocol| is the protocol being registered.
static bool ShowMakeChromeDefaultProtocolClientSystemUI(
BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& protocol);
// Registers Chrome as a potential default browser and handler for filetypes
@@ -502,7 +502,7 @@ class ShellUtil {
//
// Returns true if Chrome is successfully registered (or already registered).
static bool RegisterChromeBrowser(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& unique_suffix,
bool elevate_if_not_admin);
@@ -524,7 +524,7 @@ class ShellUtil {
// |elevate_if_not_admin| if true will make this method try alternate methods
// as described above.
static bool RegisterChromeForProtocol(BrowserDistribution* dist,
- const base::string16& chrome_exe,
+ const base::FilePath& chrome_exe,
const base::string16& unique_suffix,
const base::string16& protocol,
bool elevate_if_not_admin);
diff --git a/win8/delegate_execute/chrome_util.cc b/win8/delegate_execute/chrome_util.cc
index e973273..0f85d6dd 100644
--- a/win8/delegate_execute/chrome_util.cc
+++ b/win8/delegate_execute/chrome_util.cc
@@ -105,7 +105,7 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
base::Process process;
- if (InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) {
+ if (InstallUtil::IsPerUserInstall(chrome_exe)) {
// Read the update command from the registry.
base::string16 update_command;
if (!GetUpdateCommand(true, &update_command)) {
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index bea3e75..6aca5a1 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -250,8 +250,7 @@ STDMETHODIMP CommandExecuteImpl::Execute() {
}
BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
- bool is_per_user_install = InstallUtil::IsPerUserInstall(
- chrome_exe_.value().c_str());
+ bool is_per_user_install = InstallUtil::IsPerUserInstall(chrome_exe_);
base::string16 app_id = ShellUtil::GetBrowserModelId(
distribution, is_per_user_install);