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

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

Issue 685103004: Refactor chrome_launcher_support::GetAnyChromePath. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments. Created 5 years, 11 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
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 1c95519c6e9e7f771c7769fd8e03b54c96b76440..e8bd45b7bb6be86360f1c484b880e9caf3a5ef0d 100644
--- a/chrome/installer/launcher_support/chrome_launcher_support.cc
+++ b/chrome/installer/launcher_support/chrome_launcher_support.cc
@@ -113,39 +113,29 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path,
return base::FilePath();
}
-// Returns the path to an installed SxS chrome.exe at the specified level, if
-// it can be found via the registry.
-base::FilePath GetChromeSxSPathForInstallationLevel(InstallationLevel level) {
+} // namespace
+
+base::FilePath GetChromePathForInstallationLevel(InstallationLevel level,
+ bool is_sxs) {
+ if (is_sxs) {
#if defined(GOOGLE_CHROME_BUILD)
- return FindExeRelativeToSetupExe(
- GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe);
+ return FindExeRelativeToSetupExe(
+ GetSetupExeFromRegistry(level, kSxSBrowserAppGuid), kChromeExe);
#else
- // There is no SxS build for Chromium.
- return base::FilePath();
+ // There is no SxS build for Chromium.
+ return base::FilePath();
#endif
+ } else {
+ return FindExeRelativeToSetupExe(GetSetupExeForInstallationLevel(level),
+ kChromeExe);
+ }
}
-} // namespace
-
-base::FilePath GetChromePathForInstallationLevel(InstallationLevel level) {
- return FindExeRelativeToSetupExe(
- GetSetupExeForInstallationLevel(level), kChromeExe);
-}
-
-base::FilePath GetAnyChromePath() {
- base::FilePath chrome_path;
- if (chrome_path.empty())
- chrome_path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION);
- if (chrome_path.empty())
- chrome_path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION);
- return chrome_path;
-}
-
-base::FilePath GetAnyChromeSxSPath() {
- base::FilePath path =
- GetChromeSxSPathForInstallationLevel(USER_LEVEL_INSTALLATION);
+base::FilePath GetAnyChromePath(bool is_sxs) {
+ base::FilePath path;
+ path = GetChromePathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION, is_sxs);
if (path.empty())
- path = GetChromeSxSPathForInstallationLevel(SYSTEM_LEVEL_INSTALLATION);
+ path = GetChromePathForInstallationLevel(USER_LEVEL_INSTALLATION, is_sxs);
return path;
}

Powered by Google App Engine
This is Rietveld 408576698