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

Unified Diff: chrome/installer/setup/install.cc

Issue 14031025: Implementing unified Chrome / App Launcher flow, and migrating old stand-alone App Launcher. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index f64ed8e4820ca1b5243f5ded5b4c467e579c8ecb..09743d1051d6a9b54917b956422b44d05fbd0636 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -247,9 +247,9 @@ installer::InstallStatus InstallNewVersion(
// Launch shortcut. Both of these were created prior to Chrome 24; in Chrome 24,
// the uninstall shortcut was removed and the Default user Quick Launch shortcut
// was replaced by per-user shortcuts created via Active Setup.
-void CleanupLegacyShortcuts(const InstallerState& installer_state,
- BrowserDistribution* dist,
- const base::FilePath& chrome_exe) {
+void CleanupLegacyChromeShortcuts(const InstallerState& installer_state,
+ BrowserDistribution* dist,
+ const base::FilePath& chrome_exe) {
ShellUtil::ShellChange shortcut_level = installer_state.system_install() ?
ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
base::FilePath uninstall_shortcut_path;
@@ -283,6 +283,13 @@ installer::InstallShortcutOperation GetAppLauncherShortcutOperation(
return installer::INSTALL_SHORTCUT_REPLACE_EXISTING;
}
+void MigrateLagacyAppLauncherShortcuts(const InstallerState& installer_state) {
+ const base::FilePath app_host_exe(
+ installer_state.target_path().Append(installer::kChromeAppHostExe));
+ const base::FilePath chrome_exe(
+ installer_state.target_path().Append(installer::kChromeExe));
+}
gab 2013/04/29 20:25:41 This doesn't do anything :)
huangs 2013/04/30 14:01:49 This is a stub to call code in https://chromiumcod
+
} // end namespace
namespace installer {
@@ -532,20 +539,31 @@ InstallStatus InstallOrUpdateProduct(
installer_state.UpdateStage(installer::CREATING_SHORTCUTS);
+ InstallShortcutLevel install_level = installer_state.system_install() ?
+ ALL_USERS : CURRENT_USER;
+ const base::FilePath chrome_exe(
gab 2013/04/29 20:25:41 indent
huangs 2013/04/30 14:01:49 Done.
+ installer_state.target_path().Append(kChromeExe));
+
const Product* app_launcher_product =
installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST);
// Creates shortcuts for App Launcher.
if (app_launcher_product) {
- // TODO(huangs): Remove this check once we have system-level App Host.
- DCHECK(!installer_state.system_install());
- const base::FilePath app_host_exe(
- installer_state.target_path().Append(kChromeAppHostExe));
- InstallShortcutOperation app_launcher_shortcut_operation =
- GetAppLauncherShortcutOperation(original_state, installer_state);
-
- // Always install per-user shortcuts for App Launcher.
- CreateOrUpdateShortcuts(app_host_exe, *app_launcher_product, prefs,
- CURRENT_USER, app_launcher_shortcut_operation);
+ // If we have a legacy user-level App Launcher that uses app_host.exe,
+ // then migrate shortcuts.
+ if (!installer_state.system_install()) {
+ const ProductState* orig_product = original_state.GetProductState(
+ false, BrowserDistribution::CHROME_APP_HOST);
+ if (orig_product && chrome_launcher_support::HasLegacyAppHostExe(
+ orig_product->version())) {
+ MigrateLagacyAppLauncherShortcuts(installer_state);
+ }
+ }
+ if (installer_state.create_app_launcher_shortcuts()) {
+ InstallShortcutOperation app_launcher_shortcut_operation =
+ GetAppLauncherShortcutOperation(original_state, installer_state);
+ CreateOrUpdateShortcuts(chrome_exe, *app_launcher_product, prefs,
+ install_level, app_launcher_shortcut_operation);
gab 2013/04/29 20:25:41 Wait, are we creating All-users app launcher short
huangs 2013/04/30 14:01:49 Chrome and App Launcher are unified, so whatever C
+ }
}
const Product* chrome_product =
@@ -553,18 +571,13 @@ InstallStatus InstallOrUpdateProduct(
// Creates shortcuts for Chrome.
if (chrome_product) {
BrowserDistribution* chrome_dist = chrome_product->distribution();
- const base::FilePath chrome_exe(
- installer_state.target_path().Append(kChromeExe));
- CleanupLegacyShortcuts(installer_state, chrome_dist, chrome_exe);
+ CleanupLegacyChromeShortcuts(installer_state, chrome_dist, chrome_exe);
// Install per-user shortcuts on user-level installs and all-users
gab 2013/04/29 20:25:41 This comment belonged with the code that moved.
huangs 2013/04/30 14:01:49 I thought this refers to CreateOrUpdateShortcuts()
// shortcuts on system-level installs. Note that Active Setup will take
// care of installing missing per-user shortcuts on system-level install
// (i.e., quick launch, taskbar pin, and possibly deleted all-users
// shortcuts).
- InstallShortcutLevel install_level = installer_state.system_install() ?
- ALL_USERS : CURRENT_USER;
-
InstallShortcutOperation install_operation =
INSTALL_SHORTCUT_REPLACE_EXISTING;
if (result == installer::FIRST_INSTALL_SUCCESS ||

Powered by Google App Engine
This is Rietveld 408576698