Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7679)

Unified Diff: chrome/installer/launcher_support/chrome_launcher_support.cc

Issue 686383002: launcher_support: Gets the correct executable path for Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments to not mention Omaha or ClientState. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/launcher_support/chrome_launcher_support.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/launcher_support/chrome_launcher_support.cc
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc
index 8d052a9b88a5efe36a9eed2a21e786147d93379f..1c95519c6e9e7f771c7769fd8e03b54c96b76440 100644
--- a/chrome/installer/launcher_support/chrome_launcher_support.cc
+++ b/chrome/installer/launcher_support/chrome_launcher_support.cc
@@ -16,7 +16,8 @@ namespace chrome_launcher_support {
namespace {
// TODO(huangs) Refactor the constants: http://crbug.com/148538
-const wchar_t kGoogleRegClientStateKey[] =
+#if defined(GOOGLE_CHROME_BUILD)
+const wchar_t kInstallationRegKey[] =
L"Software\\Google\\Update\\ClientState";
// Copied from chrome_appid.cc.
@@ -27,21 +28,25 @@ const wchar_t kBrowserAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
// Copied frome google_chrome_sxs_distribution.cc.
const wchar_t kSxSBrowserAppGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
+#else
+const wchar_t kInstallationRegKey[] = L"Software\\Chromium";
Matt Giuca 2014/10/30 05:20:07 Note: The \Software\Chromium registry key contains
+#endif
// Copied from util_constants.cc.
const wchar_t kChromeExe[] = L"chrome.exe";
const wchar_t kUninstallStringField[] = L"UninstallString";
-// Reads a string value from the specified product's "ClientState" registry key.
-// Returns true iff the value is present and successfully read.
+// Reads a string value from the specified product's registry key. Returns true
+// iff the value is present and successfully read.
bool GetClientStateValue(InstallationLevel level,
const wchar_t* app_guid,
const wchar_t* value_name,
base::string16* value) {
HKEY root_key = (level == USER_LEVEL_INSTALLATION) ?
HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
- base::string16 subkey(kGoogleRegClientStateKey);
- subkey.append(1, L'\\').append(app_guid);
+ base::string16 subkey(kInstallationRegKey);
+ if (app_guid)
+ subkey.append(1, L'\\').append(app_guid);
base::win::RegKey reg_key;
// Google Update always uses 32bit hive.
if (reg_key.Open(root_key, subkey.c_str(),
@@ -54,8 +59,8 @@ bool GetClientStateValue(InstallationLevel level,
}
// Reads the path to setup.exe from the value "UninstallString" within the
-// specified product's "ClientState" registry key. Returns an empty FilePath if
-// an error occurs or the product is not installed at the specified level.
+// specified product's registry key. Returns an empty FilePath if an error
+// occurs or the product is not installed at the specified level.
base::FilePath GetSetupExeFromRegistry(InstallationLevel level,
const wchar_t* app_guid) {
base::string16 uninstall;
@@ -68,21 +73,27 @@ base::FilePath GetSetupExeFromRegistry(InstallationLevel level,
}
// Returns the path to an existing setup.exe at the specified level, if it can
-// be found via Omaha client state.
+// be found via the registry.
base::FilePath GetSetupExeForInstallationLevel(InstallationLevel level) {
+ base::FilePath setup_exe_path;
+#if defined(GOOGLE_CHROME_BUILD)
// Look in the registry for Chrome Binaries first.
- base::FilePath setup_exe_path(
- GetSetupExeFromRegistry(level, kBinariesAppGuid));
+ setup_exe_path = GetSetupExeFromRegistry(level, kBinariesAppGuid);
// If the above fails, look in the registry for Chrome next.
if (setup_exe_path.empty())
setup_exe_path = GetSetupExeFromRegistry(level, kBrowserAppGuid);
// If we fail again, then setup_exe_path would be empty.
+#else
+ // For Chromium, there are no GUIDs. Just look in the Chromium registry key.
+ setup_exe_path = GetSetupExeFromRegistry(level, nullptr);
+#endif
+
return setup_exe_path;
}
// Returns the path to an installed |exe_file| (e.g. chrome.exe) at the
-// specified level, given |setup_exe_path| from Omaha client state. Returns
-// empty base::FilePath if none found, or if |setup_exe_path| is empty.
+// specified level, given |setup_exe_path| from the registry. Returns empty
+// base::FilePath if none found, or if |setup_exe_path| is empty.
base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path,
const wchar_t* exe_file) {
if (!setup_exe_path.empty()) {
@@ -103,10 +114,15 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path,
}
// Returns the path to an installed SxS chrome.exe at the specified level, if
-// it can be found via Omaha client state.
+// it can be found via the registry.
base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) {
+#if defined(GOOGLE_CHROME_BUILD)
return FindExeRelativeToSetupExe(
GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe);
+#else
+ // There is no SxS build for Chromium.
+ return base::FilePath();
+#endif
}
} // namespace
« no previous file with comments | « chrome/installer/launcher_support/chrome_launcher_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698