summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 01:53:48 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-11 01:53:48 +0000
commitf06893891d51e80f26b7b785a27cc25dda814f68 (patch)
tree4a424838af32c9aa7726eb0cfa7fc988ff7d545d /chrome/installer/setup
parent128dca3b2100acebb549d823ea58983335eb8297 (diff)
downloadchromium_src-f06893891d51e80f26b7b785a27cc25dda814f68.zip
chromium_src-f06893891d51e80f26b7b785a27cc25dda814f68.tar.gz
chromium_src-f06893891d51e80f26b7b785a27cc25dda814f68.tar.bz2
Keep installing all-users Start Menu and Desktop shortcuts on system-level installs.
Also, pin the system-level shortcut if pinning was requested when creating the user-level shortcut, but it isn't created because its system-level match is present. BUG=164655 TEST= Below "all shortcuts" refers to: Desktop, Quick Launch, Start Menu (Start Screen on Win8), and taskbar shortcuts. Have 5 users (setup this way BEFORE installing system-level Chrome -- might be worth to save a VM with this state before installing system-level Chrome...): User A => M23 user-level Chrome installed (he will also be the user installing system-level Chrome) User B => M23 user-level Chrome installed, but logged out. User C => M23 user-level Chrome installed, but stays logged in. User D => No user-level install. User E => No user-level install. From user A, install a system-level Chrome including this CL. User A should have both types of shortcuts (per-user + all-users); invoking any of the per-user shortcuts should self-destruct the user-level Chrome (deleting its shortcuts in the process). Login to User B: He should also have both types shortcuts and self-destruct should happen when invoking user-level Chrome. Go to user C (should have been logged in and stayed logged in since the system-level install): User C will have both types of shortcuts (he will however be missing the system-level taskbar pin; and that until either next login or system-level first run). Self-destruct should happen the same way. Login to user D: He should have all system-level shortcuts. **Delete the all-users Desktop shortcut.** Login to user E: He should have all system-level shortcuts (the Desktop shortcut will be a per-user shortcut pointing to system-level Chrome) :)! This is a nice side-effect of the previous work I did (will not work for users who later go through self-destruct or who have already ran system-level Chrome, but still a nice side-effect feature!). Review URL: https://chromiumcodereview.appspot.com/11465025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r--chrome/installer/setup/install.cc31
-rw-r--r--chrome/installer/setup/install.h6
2 files changed, 22 insertions, 15 deletions
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 8726ee2..7aa2319 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -374,7 +374,6 @@ bool CreateVisualElementsManifest(const FilePath& src_path,
}
}
-// TODO(tommi): Change this function to use WorkItemList.
void CreateOrUpdateShortcuts(
const FilePath& target,
const Product& product,
@@ -442,9 +441,13 @@ void CreateOrUpdateShortcuts(
if (!do_not_create_quick_launch_shortcut ||
shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) {
+ // There is no such thing as an all-users Quick Launch shortcut, always
+ // install the per-user shortcut.
+ ShellUtil::ShortcutProperties quick_launch_properties(base_properties);
+ quick_launch_properties.level = ShellUtil::CURRENT_USER;
ExecuteAndLogShortcutOperation(
- ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, base_properties,
- shortcut_operation);
+ ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist,
+ quick_launch_properties, shortcut_operation);
}
ShellUtil::ShortcutProperties start_menu_properties(base_properties);
@@ -571,6 +574,14 @@ InstallStatus InstallOrUpdateProduct(
installer_state.target_path().Append(kChromeExe));
CleanupLegacyShortcuts(installer_state, dist, chrome_exe);
+ // Install per-user shortcuts on user-level installs and all-users
+ // 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 ||
@@ -578,14 +589,7 @@ InstallStatus InstallOrUpdateProduct(
install_operation = INSTALL_SHORTCUT_CREATE_ALL;
}
- if (installer_state.system_install()) {
- // Update existing all-users shortcuts for legacy installs.
- CreateOrUpdateShortcuts(chrome_exe, *chrome_product, prefs, ALL_USERS,
- INSTALL_SHORTCUT_REPLACE_EXISTING);
- }
- // Always install per-user shortcuts (even on system-level installs where
- // we do so for the installing user instead of waiting for Active Setup).
- CreateOrUpdateShortcuts(chrome_exe, *chrome_product, prefs, CURRENT_USER,
+ CreateOrUpdateShortcuts(chrome_exe, *chrome_product, prefs, install_level,
install_operation);
}
@@ -652,7 +656,7 @@ void HandleOsUpgradeForBrowser(const InstallerState& installer_state,
// Unfortunately, if this is a system-level install, we can't update the
// shortcuts of each individual user (this only matters if this is an OS
- // upgrade for XP/Vista to Win7+ as some properties are only set on
+ // upgrade from XP/Vista to Win7+ as some properties are only set on
// shortcuts as of Win7).
// At least attempt to update potentially existing all-users shortcuts.
InstallShortcutLevel level = installer_state.system_install() ?
@@ -678,6 +682,9 @@ void HandleActiveSetupForBrowser(const FilePath& installation_root,
FilePath first_run_sentinel;
InstallUtil::GetSentinelFilePath(
chrome::kFirstRunSentinel, chrome.distribution(), &first_run_sentinel);
+ // Decide whether to create the shortcuts or simply replace existing
+ // shortcuts; if the decision is to create them, only shortcuts whose matching
+ // all-users shortcut isn't present on the system will be created.
InstallShortcutOperation install_operation =
(!force && file_util::PathExists(first_run_sentinel) ?
INSTALL_SHORTCUT_REPLACE_EXISTING :
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h
index 3a7b175..b8c35f1 100644
--- a/chrome/installer/setup/install.h
+++ b/chrome/installer/setup/install.h
@@ -41,9 +41,9 @@ enum InstallShortcutOperation {
enum InstallShortcutLevel {
// Install shortcuts for the current user only.
CURRENT_USER,
- // Install global shortcuts visible to all users. This is no longer used on
- // install and should only be used to update existing shortcuts on legacy
- // installs.
+ // Install global shortcuts visible to all users. Note: the Quick Launch
+ // and taskbar pin shortcuts are still installed per-user (as they have no
+ // all-users version).
ALL_USERS,
};