diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-09-19 22:36:51 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-09-19 22:36:51 +0100 |
commit | d0247b1b59f9c528cb6df88b4f2b9afaf80d181e (patch) | |
tree | 5c397fadc190cc71bffe2ffad1efc27a5b95309d /chrome/installer | |
parent | f7571f5f07547e2f3e0addf48d1f2a7ec3632957 (diff) | |
download | chromium_org-d0247b1b59f9c528cb6df88b4f2b9afaf80d181e.tar.gz |
Merge from Chromium at DEPS revision 224184
This commit was generated by merge_to_master.py.
Change-Id: Ia3424df5abed9bea642c522b9e2358dceabd8423
Diffstat (limited to 'chrome/installer')
27 files changed, 411 insertions, 273 deletions
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include index 561b42af10..b115ad377c 100644 --- a/chrome/installer/linux/common/installer.include +++ b/chrome/installer/linux/common/installer.include @@ -76,6 +76,7 @@ process_template() ( -e "s#@@SHORTDESC@@#${SHORTDESC}#g" \ -e "s#@@FULLDESC@@#${FULLDESC}#g" \ -e "s#@@DEFAULT_FLAGS@@#${DEFAULT_FLAGS:-}#g" \ + -e "s#@@SXS_USER_DATA_DIR@@#${SXS_USER_DATA_DIR:-}#g" \ > "$TMPLOUT" <<< "$TMPLINCL" ) diff --git a/chrome/installer/linux/common/wrapper b/chrome/installer/linux/common/wrapper index 3cd55d507a..774a83d4e4 100755 --- a/chrome/installer/linux/common/wrapper +++ b/chrome/installer/linux/common/wrapper @@ -39,4 +39,13 @@ export CHROME_VERSION_EXTRA="@@CHANNEL@@" # We don't want bug-buddy intercepting our crashes. http://crbug.com/24120 export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME +# Automagically migrate user data directory. +# TODO(phajdan.jr): Remove along with migration code in the browser for M33. +if [[ -n "@@SXS_USER_DATA_DIR@@" ]]; then + if [[ ! -d "@@SXS_USER_DATA_DIR@@" ]]; then + "$HERE/@@PROGNAME@@" "--migrate-data-dir-for-sxs=@@SXS_USER_DATA_DIR@@" \ + --enable-logging=stderr --log-level=0 + fi +fi + exec -a "$0" "$HERE/@@PROGNAME@@" @@DEFAULT_FLAGS@@ "$@" diff --git a/chrome/installer/linux/debian/build.sh b/chrome/installer/linux/debian/build.sh index 39e2153465..290aaef053 100755 --- a/chrome/installer/linux/debian/build.sh +++ b/chrome/installer/linux/debian/build.sh @@ -23,13 +23,7 @@ gen_changelog() { process_template "${SCRIPTDIR}/changelog.template" "${DEB_CHANGELOG}" debchange -a --nomultimaint -m --changelog "${DEB_CHANGELOG}" \ "Release Notes: ${RELEASENOTES}" - # Trunk packages need to install to a custom path and with custom filenames - # (e.g. not /usr/bin/google-chrome) so they don't conflict with release - # channel packages. - if [ "$CHANNEL" = "trunk" ] || [ "$CHANNEL" = "asan" ]; then - local PACKAGE="${PACKAGE}-${CHANNEL}" - fi - GZLOG="${STAGEDIR}/usr/share/doc/${PACKAGE}/changelog.gz" + GZLOG="${STAGEDIR}/usr/share/doc/${PACKAGE}-${CHANNEL}/changelog.gz" mkdir -p "$(dirname "${GZLOG}")" gzip -9 -c "${DEB_CHANGELOG}" > "${GZLOG}" chmod 644 "${GZLOG}" @@ -54,19 +48,22 @@ prep_staging_debian() { # Put the package contents in the staging area. stage_install_debian() { - # Trunk packages need to install to a custom path and with custom filenames - # (e.g. not /usr/bin/google-chrome) so they don't conflict with release - # channel packages. - if [ "$CHANNEL" = "trunk" ] || [ "$CHANNEL" = "asan" ]; then + if [ "$CHANNEL" != "stable" ]; then + # Avoid file collisions between channels. local PACKAGE="${PACKAGE}-${CHANNEL}" local INSTALLDIR="${INSTALLDIR}-${CHANNEL}" + + # Make it possible to distinguish between menu entries + # for different channels. + local MENUNAME="${MENUNAME} (${CHANNEL})" + # This would ideally be compiled into the app, but that's a bit too # intrusive of a change for these limited use channels, so we'll just hack # it into the wrapper script. The user can still override since it seems to # work to specify --user-data-dir multiple times on the command line, with # the last occurrence winning. - local DEFAULT_FLAGS="--user-data-dir=\"\${HOME}/.config/${PACKAGE}\"" - local MENUNAME="${MENUNAME} (${CHANNEL})" + local SXS_USER_DATA_DIR="\${XDG_CONFIG_HOME:-\${HOME}/.config}/${PACKAGE}" + local DEFAULT_FLAGS="--user-data-dir=\"${SXS_USER_DATA_DIR}\"" fi prep_staging_debian stage_install_common @@ -97,13 +94,9 @@ do_package() { echo "Packaging ${ARCHITECTURE}..." PREDEPENDS="$COMMON_PREDEPS" DEPENDS="${COMMON_DEPS}" - # Trunk is a special package, mostly for development testing, so don't make - # it replace any installed release packages. - if [ "$CHANNEL" != "trunk" ] && [ "$CHANNEL" != "asan" ]; then - REPLACES="${PACKAGE}" - CONFLICTS="${PACKAGE}" - PROVIDES="${PACKAGE}, www-browser" - fi + REPLACES="" + CONFLICTS="" + PROVIDES="www-browser" gen_changelog process_template "${SCRIPTDIR}/control.template" "${DEB_CONTROL}" export DEB_HOST_ARCH="${ARCHITECTURE}" @@ -234,7 +227,7 @@ fi eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \ "${BUILDDIR}/installer/theme/BRANDING") -REPOCONFIG="deb http://dl.google.com/linux/${PACKAGE#google-}/deb/ stable main" +REPOCONFIG="deb http://dl.google.com/linux/chrome/deb/ stable main" verify_channel # Some Debian packaging tools want these set. diff --git a/chrome/installer/linux/debian/expected_deps b/chrome/installer/linux/debian/expected_deps index f545951d47..ef2b0a27a3 100644 --- a/chrome/installer/linux/debian/expected_deps +++ b/chrome/installer/linux/debian/expected_deps @@ -15,7 +15,7 @@ libgdk-pixbuf2.0-0 (>= 2.22.0) libglib2.0-0 (>= 2.18.0) libgtk2.0-0 (>= 2.24.0) libnspr4 (>= 1.8.0.10) -libnss3 (>= 3.12.6) +libnss3 (>= 3.14.3) libpango1.0-0 (>= 1.22.0) libstdc++6 (>= 4.6) libudev0 (>= 147) @@ -24,6 +24,7 @@ libxcomposite1 (>= 1:0.3-1) libxdamage1 (>= 1:1.1) libxext6 libxfixes3 +libxi6 (>= 2:1.2.99.4) libxrender1 libxss1 libxtst6 diff --git a/chrome/installer/linux/rpm/expected_deps_i386 b/chrome/installer/linux/rpm/expected_deps_i386 index b2d7944390..8401dcffb2 100644 --- a/chrome/installer/linux/rpm/expected_deps_i386 +++ b/chrome/installer/linux/rpm/expected_deps_i386 @@ -68,6 +68,7 @@ libXcomposite.so.1 libXdamage.so.1 libXext.so.6 libXfixes.so.3 +libXi.so.6 libXrender.so.1 libXss.so.1 libXtst.so.6 diff --git a/chrome/installer/linux/rpm/expected_deps_x86_64 b/chrome/installer/linux/rpm/expected_deps_x86_64 index 0d0fac3e4d..bfd60cd952 100644 --- a/chrome/installer/linux/rpm/expected_deps_x86_64 +++ b/chrome/installer/linux/rpm/expected_deps_x86_64 @@ -58,6 +58,7 @@ libXcomposite.so.1()(64bit) libXdamage.so.1()(64bit) libXext.so.6()(64bit) libXfixes.so.3()(64bit) +libXi.so.6()(64bit) libXrender.so.1()(64bit) libXss.so.1()(64bit) libXtst.so.6()(64bit) diff --git a/chrome/installer/mini_installer.gyp b/chrome/installer/mini_installer.gyp index d0d680f5bc..385c93028c 100644 --- a/chrome/installer/mini_installer.gyp +++ b/chrome/installer/mini_installer.gyp @@ -14,159 +14,114 @@ ], 'conditions': [ ['OS=="win"', { - 'target_defaults': { - 'dependencies': [ - '../chrome.gyp:chrome', - '../chrome.gyp:chrome_nacl_win64', - '../chrome.gyp:chrome_dll', - '../chrome.gyp:default_extensions', - '../chrome.gyp:setup', - ], - 'include_dirs': [ - '../..', - '<(INTERMEDIATE_DIR)', - '<(SHARED_INTERMEDIATE_DIR)/chrome', - ], - 'sources': [ - 'mini_installer/appid.h', - 'mini_installer/configuration.cc', - 'mini_installer/configuration.h', - 'mini_installer/decompress.cc', - 'mini_installer/decompress.h', - 'mini_installer/mini_installer.cc', - 'mini_installer/mini_installer.h', - 'mini_installer/mini_installer.ico', - 'mini_installer/mini_installer.rc', - 'mini_installer/mini_installer_exe_version.rc.version', - 'mini_installer/mini_installer_resource.h', - 'mini_installer/mini_string.cc', - 'mini_installer/mini_string.h', - 'mini_installer/pe_resource.cc', - 'mini_installer/pe_resource.h', - '<(INTERMEDIATE_DIR)/packed_files.rc', - ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'EnableIntrinsicFunctions': 'true', - 'BufferSecurityCheck': 'false', - 'BasicRuntimeChecks': '0', - 'ExceptionHandling': '0', - }, - 'VCLinkerTool': { - 'RandomizedBaseAddress': '1', - 'DataExecutionPrevention': '0', - 'AdditionalLibraryDirectories': [ - '<(PRODUCT_DIR)/lib' - ], - 'DelayLoadDLLs': [], - 'EntryPointSymbol': 'MainEntryPoint', - 'IgnoreAllDefaultLibraries': 'true', - 'OptimizeForWindows98': '1', - 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS - 'AdditionalDependencies': [ - 'shlwapi.lib', - 'setupapi.lib', - ], - }, - 'VCManifestTool': { - 'AdditionalManifestFiles': [ - '$(ProjectDir)\\mini_installer\\mini_installer.exe.manifest', - ], - }, - }, - 'configurations': { - 'Debug_Base': { - 'msvs_settings': { - 'VCCLCompilerTool': { - 'BasicRuntimeChecks': '0', - 'BufferSecurityCheck': 'false', - 'ExceptionHandling': '0', - }, - 'VCLinkerTool': { - 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS - 'AdditionalOptions': [ - '/safeseh:no', - '/dynamicbase:no', - '/ignore:4199', - '/ignore:4221', - '/nxcompat', - ], - }, + 'targets': [ + { + 'target_name': 'mini_installer', + 'type': 'executable', + + 'dependencies': [ + '../chrome.gyp:chrome', + '../chrome.gyp:chrome_nacl_win64', + '../chrome.gyp:chrome_dll', + '../chrome.gyp:default_extensions', + '../chrome.gyp:setup', + ], + 'include_dirs': [ + '../..', + '<(INTERMEDIATE_DIR)', + '<(SHARED_INTERMEDIATE_DIR)/chrome', + ], + 'sources': [ + 'mini_installer/appid.h', + 'mini_installer/chrome.release', + 'mini_installer/chrome_appid.cc', + 'mini_installer/configuration.cc', + 'mini_installer/configuration.h', + 'mini_installer/decompress.cc', + 'mini_installer/decompress.h', + 'mini_installer/mini_installer.cc', + 'mini_installer/mini_installer.h', + 'mini_installer/mini_installer.ico', + 'mini_installer/mini_installer.rc', + 'mini_installer/mini_installer_exe_version.rc.version', + 'mini_installer/mini_installer_resource.h', + 'mini_installer/mini_string.cc', + 'mini_installer/mini_string.h', + 'mini_installer/pe_resource.cc', + 'mini_installer/pe_resource.h', + '<(INTERMEDIATE_DIR)/packed_files.rc', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableIntrinsicFunctions': 'true', + 'BufferSecurityCheck': 'false', + 'BasicRuntimeChecks': '0', + 'ExceptionHandling': '0', }, - }, - 'Release_Base': { - 'includes': ['../../build/internal/release_defaults.gypi'], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'EnableIntrinsicFunctions': 'true', - 'BasicRuntimeChecks': '0', - 'BufferSecurityCheck': 'false', - 'ExceptionHandling': '0', - }, - 'VCLinkerTool': { - 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS - 'Profile': 'false', # Conflicts with /FIXED - 'AdditionalOptions': [ - '/SAFESEH:NO', - '/NXCOMPAT', - '/DYNAMICBASE:NO', - '/FIXED', - ], - }, + 'VCLinkerTool': { + 'RandomizedBaseAddress': '1', + 'DataExecutionPrevention': '0', + 'AdditionalLibraryDirectories': [ + '<(PRODUCT_DIR)/lib' + ], + 'DelayLoadDLLs': [], + 'EntryPointSymbol': 'MainEntryPoint', + 'IgnoreAllDefaultLibraries': 'true', + 'OptimizeForWindows98': '1', + 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS + 'AdditionalDependencies': [ + 'shlwapi.lib', + 'setupapi.lib', + ], }, - }, - }, - 'rules': [ - { - 'rule_name': 'mini_installer_version', - 'extension': 'version', - 'variables': { - 'template_input_path': 'mini_installer/mini_installer_exe_version.rc.version', + 'VCManifestTool': { + 'AdditionalManifestFiles': [ + '$(ProjectDir)\\mini_installer\\mini_installer.exe.manifest', + ], }, - 'inputs': [ - '<(template_input_path)', - '<(version_path)', - '<(lastchange_path)', - '<(branding_dir)/BRANDING', - ], - 'outputs': [ - '<(PRODUCT_DIR)/mini_installer_exe_version.rc', - ], - 'action': [ - 'python', '<(version_py)', - '-f', '<(version_path)', - '-f', '<(lastchange_path)', - '-f', '<(branding_dir)/BRANDING', - '<(template_input_path)', - '<@(_outputs)', - ], - 'process_outputs_as_sources': 1, - 'message': 'Generating version information' }, - ], - # TODO(mark): <(branding_dir) should be defined by the - # global condition block at the bottom of the file, but - # this doesn't work due to the following issue: - # - # http://code.google.com/p/gyp/issues/detail?id=22 - # - # Remove this block once the above issue is fixed. - 'conditions': [ - [ 'branding == "Chrome"', { - 'variables': { - 'branding_dir': '../app/theme/google_chrome', + 'configurations': { + 'Debug_Base': { + 'msvs_settings': { + 'VCCLCompilerTool': { + 'BasicRuntimeChecks': '0', + 'BufferSecurityCheck': 'false', + 'ExceptionHandling': '0', + }, + 'VCLinkerTool': { + 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS + 'AdditionalOptions': [ + '/safeseh:no', + '/dynamicbase:no', + '/ignore:4199', + '/ignore:4221', + '/nxcompat', + ], + }, + }, }, - }, { # else branding!="Chrome" - 'variables': { - 'branding_dir': '../app/theme/chromium', + 'Release_Base': { + 'includes': ['../../build/internal/release_defaults.gypi'], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableIntrinsicFunctions': 'true', + 'BasicRuntimeChecks': '0', + 'BufferSecurityCheck': 'false', + 'ExceptionHandling': '0', + }, + 'VCLinkerTool': { + 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS + 'Profile': 'false', # Conflicts with /FIXED + 'AdditionalOptions': [ + '/SAFESEH:NO', + '/NXCOMPAT', + '/DYNAMICBASE:NO', + '/FIXED', + ], + }, + }, }, - }], - ], - }, - 'targets': [ - { - 'target_name': 'mini_installer', - 'type': 'executable', + }, # Disable precompiled headers for this project, to avoid # linker errors when building with VS 2008. @@ -182,12 +137,34 @@ # TODO(yukawa): Enable the common compatibility manifest again. 'win_exe_compatibility_manifest': '', }, - 'sources': [ - 'mini_installer/chrome.release', - 'mini_installer/chrome_appid.cc', - ], 'rules': [ { + 'rule_name': 'mini_installer_version', + 'extension': 'version', + 'variables': { + 'template_input_path': 'mini_installer/mini_installer_exe_version.rc.version', + }, + 'inputs': [ + '<(template_input_path)', + '<(version_path)', + '<(lastchange_path)', + '<(branding_dir)/BRANDING', + ], + 'outputs': [ + '<(PRODUCT_DIR)/mini_installer_exe_version.rc', + ], + 'action': [ + 'python', '<(version_py)', + '-f', '<(version_path)', + '-f', '<(lastchange_path)', + '-f', '<(branding_dir)/BRANDING', + '<(template_input_path)', + '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + 'message': 'Generating version information' + }, + { 'rule_name': 'installer_archive', 'extension': 'release', 'variables': { @@ -289,8 +266,46 @@ 'msvs_cygwin_shell': 1, }, ], + # TODO(mark): <(branding_dir) should be defined by the + # global condition block at the bottom of the file, but + # this doesn't work due to the following issue: + # + # http://code.google.com/p/gyp/issues/detail?id=22 + # + # Remove this block once the above issue is fixed. + 'conditions': [ + [ 'branding == "Chrome"', { + 'variables': { + 'branding_dir': '../app/theme/google_chrome', + }, + }, { # else branding!="Chrome" + 'variables': { + 'branding_dir': '../app/theme/chromium', + }, + }], + ], }, ], + 'conditions': [ + ['test_isolation_mode != "noop"', { + 'targets': [ + { + 'target_name': 'mini_installer_tests_run', + 'type': 'none', + 'dependencies': [ + 'mini_installer', + ], + 'includes': [ + '../../build/isolate.gypi', + 'mini_installer_tests.isolate', + ], + 'sources': [ + 'mini_installer_tests.isolate', + ], + }, + ], + }], + ], }], [ 'branding == "Chrome"', { 'variables': { diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index 3f7e739f0e..e5f93472dc 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -37,8 +37,6 @@ chrome_200_percent.pak: %(VersionDir)s\ [TOUCH] chrome_touch_100_percent.pak: %(VersionDir)s\ -chrome_touch_140_percent.pak: %(VersionDir)s\ -chrome_touch_180_percent.pak: %(VersionDir)s\ [GOOGLE_CHROME] SecondaryTile.png: %(VersionDir)s\ diff --git a/chrome/installer/mini_installer_tests.isolate b/chrome/installer/mini_installer_tests.isolate new file mode 100644 index 0000000000..83aa7eae60 --- /dev/null +++ b/chrome/installer/mini_installer_tests.isolate @@ -0,0 +1,25 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'conditions': [ + ['OS=="win"', { + 'variables': { + 'command': [ + 'python', + '../test/mini_installer/test_installer.py', + '../test/mini_installer/config/config.config', + '--build-dir=<(PRODUCT_DIR)/..', + '--target=Release', + '--force-clean', + ], + 'isolate_dependency_tracked': [ + '<(PRODUCT_DIR)/mini_installer.exe', + ], + 'isolate_dependency_untracked': [ + '../test/mini_installer/', + ], + }, + }], + ], +} diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 8693dfa834..2387ab319b 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -328,52 +328,56 @@ void CloseChromeFrameHelperProcess() { } } -// Updates shortcuts to |old_target_exe| to target |new_target_exe| instead. If -// |require_args| is set, then only updates shortcuts with non-empty targets. -// This should only be called from user-level. -void RetargetShortcuts(const InstallerState& installer_state, - const Product& product, - const base::FilePath& old_target_exe, - const base::FilePath& new_target_exe, - bool require_args) { +// Updates shortcuts to |old_target_exe| that have non-empty args, making them +// target |new_target_exe| instead. The non-empty args requirement is a +// heuristic to determine whether a shortcut is "user-generated". This routine +// can only be called for user-level installs. +void RetargetUserShortcutsWithArgs(const InstallerState& installer_state, + const Product& product, + const base::FilePath& old_target_exe, + const base::FilePath& new_target_exe) { + if (installer_state.system_install()) { + NOTREACHED(); + return; + } BrowserDistribution* dist = product.distribution(); - DCHECK(!installer_state.system_install()); ShellUtil::ShellChange install_level = ShellUtil::CURRENT_USER; ShellUtil::ShortcutProperties updated_properties(install_level); updated_properties.set_target(new_target_exe); + // TODO(huangs): Make this data-driven, along with DeleteShortcuts(). VLOG(1) << "Retargeting Desktop shortcuts."; - if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, - install_level, old_target_exe, require_args, - updated_properties)) { + if (!ShellUtil::UpdateShortcutsWithArgs( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, install_level, + old_target_exe, updated_properties)) { LOG(WARNING) << "Failed to retarget Desktop shortcuts."; } VLOG(1) << "Retargeting Quick Launch shortcuts."; - if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, - dist, install_level, old_target_exe, - require_args, updated_properties)) { + if (!ShellUtil::UpdateShortcutsWithArgs( + ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, install_level, + old_target_exe, updated_properties)) { LOG(WARNING) << "Failed to retarget Quick Launch shortcuts."; } VLOG(1) << "Retargeting Start Menu shortcuts."; - if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, - install_level, old_target_exe, require_args, - updated_properties)) { + if (!ShellUtil::UpdateShortcutsWithArgs( + ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, install_level, + old_target_exe, updated_properties)) { LOG(WARNING) << "Failed to retarget Start Menu shortcuts."; } // Retarget pinned-to-taskbar shortcuts that point to |chrome_exe|. - if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, - dist, ShellUtil::CURRENT_USER, old_target_exe, - require_args, updated_properties)) { + if (!ShellUtil::UpdateShortcutsWithArgs( + ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, dist, + ShellUtil::CURRENT_USER, old_target_exe, updated_properties)) { LOG(WARNING) << "Failed to retarget taskbar shortcuts at user-level."; } // Retarget the folder of secondary tiles from the start screen for |dist|. - if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, - dist, install_level, old_target_exe, - require_args, updated_properties)) { + if (!ShellUtil::UpdateShortcutsWithArgs( + ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, dist, install_level, + old_target_exe, updated_properties)) { LOG(WARNING) << "Failed to retarget start-screen shortcuts."; } } @@ -736,7 +740,9 @@ void RemoveFiletypeRegistration(const InstallerState& installer_state, string16 classes_path(ShellUtil::kRegClasses); classes_path.push_back(base::FilePath::kSeparators[0]); - const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); + BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); + const string16 prog_id( + distribution->GetBrowserProgIdPrefix() + browser_entry_suffix); // Delete each filetype association if it references this Chrome. Take care // not to delete the association if it references a system-level install of @@ -809,7 +815,8 @@ bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); // Delete Software\Classes\ChromeHTML. - const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); + const string16 prog_id( + dist->GetBrowserProgIdPrefix() + browser_entry_suffix); string16 reg_prog_id(ShellUtil::kRegClasses); reg_prog_id.push_back(base::FilePath::kSeparators[0]); reg_prog_id.append(prog_id); @@ -1186,8 +1193,9 @@ InstallStatus UninstallProduct(const InstallationState& original_state, auto_launch_util::DisableAllAutoStartFeatures( ASCIIToUTF16(chrome::kInitialProfile)); - // Self-destruct flow: removing user-level Chrome because system-level - // Chrome exists. + // If user-level chrome is self-destructing as a result of encountering a + // system-level chrome, retarget owned non-default shortcuts (app shortcuts, + // profile shortcuts, etc.) to the system-level chrome. if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && !installer_state.system_install()) { const base::FilePath system_chrome_path( @@ -1195,14 +1203,11 @@ InstallStatus UninstallProduct(const InstallationState& original_state, Append(installer::kChromeExe)); VLOG(1) << "Retargeting user-generated Chrome shortcuts."; if (base::PathExists(system_chrome_path)) { - // Retarget all user-generated shortcuts to user-level chrome.exe to - // system-level chrome.exe. Heuristic: consider only shortcuts that have - // non-empty args. Therefore the main user-level chrome.exe will not get - // retarged, and will get deleted by DeleteShortcuts() below. - RetargetShortcuts(installer_state, product, base::FilePath(chrome_exe), - system_chrome_path, true); + RetargetUserShortcutsWithArgs(installer_state, product, + base::FilePath(chrome_exe), + system_chrome_path); } else { - VLOG(1) << "Retarget failed: system-level Chrome not found."; + LOG(ERROR) << "Retarget failed: system-level Chrome not found."; } } diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 8a249272c8..b311d59d35 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -199,6 +199,18 @@ string16 BrowserDistribution::GetBaseAppId() { return L"Chromium"; } +string16 BrowserDistribution::GetBrowserProgIdPrefix() { + // This used to be "ChromiumHTML", but was forced to become "ChromiumHTM" + // because of http://crbug.com/153349. See the declaration of this function + // in the header file for more details. + return L"ChromiumHTM"; +} + +string16 BrowserDistribution::GetBrowserProgIdDesc() { + return L"Chromium HTML Document"; +} + + string16 BrowserDistribution::GetInstallSubDir() { return L"Chromium"; } diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index b308c04fec..1d11a87b28 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -89,6 +89,18 @@ class BrowserDistribution { // should be suffixed in all scenarios. virtual string16 GetBaseAppId(); + // Returns the Browser ProgId prefix (e.g. ChromeHTML, ChromiumHTM, etc...). + // The full id is of the form |prefix|.|suffix| and is limited to a maximum + // length of 39 characters including null-terminator. See + // http://msdn.microsoft.com/library/aa911706.aspx for details. We define + // |suffix| as a fixed-length 26-character alphanumeric identifier, therefore + // the return value of this function must have a maximum length of + // 39 - 1(null-term) - 26(|suffix|) - 1(dot separator) = 11 characters. + virtual string16 GetBrowserProgIdPrefix(); + + // Returns the Browser ProgId description. + virtual string16 GetBrowserProgIdDesc(); + virtual string16 GetInstallSubDir(); virtual string16 GetPublisherName(); @@ -117,6 +129,7 @@ class BrowserDistribution { virtual string16 GetVersionKey(); + // Returns true if this distribution can be set as the default browser. virtual bool CanSetAsDefault(); virtual bool CanCreateDesktopShortcuts(); diff --git a/chrome/installer/util/chrome_app_host_distribution.cc b/chrome/installer/util/chrome_app_host_distribution.cc index 1c4c0e13fc..be0fdf552d 100644 --- a/chrome/installer/util/chrome_app_host_distribution.cc +++ b/chrome/installer/util/chrome_app_host_distribution.cc @@ -38,6 +38,16 @@ string16 ChromeAppHostDistribution::GetBaseAppName() { return L"Google Chrome App Launcher"; } +string16 ChromeAppHostDistribution::GetBrowserProgIdPrefix() { + NOTREACHED(); + return string16(); +} + +string16 ChromeAppHostDistribution::GetBrowserProgIdDesc() { + NOTREACHED(); + return string16(); +} + string16 ChromeAppHostDistribution::GetDisplayName() { return GetShortcutName(SHORTCUT_APP_LAUNCHER); } diff --git a/chrome/installer/util/chrome_app_host_distribution.h b/chrome/installer/util/chrome_app_host_distribution.h index 24e007a32e..c0d2abb674 100644 --- a/chrome/installer/util/chrome_app_host_distribution.h +++ b/chrome/installer/util/chrome_app_host_distribution.h @@ -17,6 +17,10 @@ class ChromeAppHostDistribution : public BrowserDistribution { virtual string16 GetDisplayName() OVERRIDE; + virtual string16 GetBrowserProgIdPrefix() OVERRIDE; + + virtual string16 GetBrowserProgIdDesc() OVERRIDE; + // This can only be called with SHORTCUT_APP_LAUNCHER for |shortcut_type|. virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index f968178886..0b12cc1478 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -36,6 +36,16 @@ string16 ChromeFrameDistribution::GetBaseAppName() { return L"Google Chrome Frame"; } +string16 ChromeFrameDistribution::GetBrowserProgIdPrefix() { + NOTREACHED(); + return string16(); +} + +string16 ChromeFrameDistribution::GetBrowserProgIdDesc() { + NOTREACHED(); + return string16(); +} + string16 ChromeFrameDistribution::GetShortcutName(ShortcutType shortcut_type) { switch (shortcut_type) { case SHORTCUT_CHROME: diff --git a/chrome/installer/util/chrome_frame_distribution.h b/chrome/installer/util/chrome_frame_distribution.h index fa891d6173..45db56aac5 100644 --- a/chrome/installer/util/chrome_frame_distribution.h +++ b/chrome/installer/util/chrome_frame_distribution.h @@ -15,6 +15,10 @@ class ChromeFrameDistribution : public BrowserDistribution { public: virtual string16 GetAppGuid() OVERRIDE; + virtual string16 GetBrowserProgIdPrefix() OVERRIDE; + + virtual string16 GetBrowserProgIdDesc() OVERRIDE; + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; diff --git a/chrome/installer/util/chromium_binaries_distribution.cc b/chrome/installer/util/chromium_binaries_distribution.cc index 004e6176a6..62c645b269 100644 --- a/chrome/installer/util/chromium_binaries_distribution.cc +++ b/chrome/installer/util/chromium_binaries_distribution.cc @@ -29,6 +29,16 @@ string16 ChromiumBinariesDistribution::GetBaseAppName() { return string16(); } +string16 ChromiumBinariesDistribution::GetBrowserProgIdPrefix() { + NOTREACHED(); + return string16(); +} + +string16 ChromiumBinariesDistribution::GetBrowserProgIdDesc() { + NOTREACHED(); + return string16(); +} + string16 ChromiumBinariesDistribution::GetDisplayName() { return kChromiumBinariesName; } diff --git a/chrome/installer/util/chromium_binaries_distribution.h b/chrome/installer/util/chromium_binaries_distribution.h index 43c87ccde9..68de283e3f 100644 --- a/chrome/installer/util/chromium_binaries_distribution.h +++ b/chrome/installer/util/chromium_binaries_distribution.h @@ -15,6 +15,10 @@ class ChromiumBinariesDistribution : public BrowserDistribution { public: virtual string16 GetAppGuid() OVERRIDE; + virtual string16 GetBrowserProgIdPrefix() OVERRIDE; + + virtual string16 GetBrowserProgIdDesc() OVERRIDE; + virtual string16 GetDisplayName() OVERRIDE; virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 2ae5338f23..3d87f60816 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -35,6 +35,8 @@ namespace { const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; const wchar_t kBrowserAppId[] = L"Chrome"; +const wchar_t kBrowserProgIdPrefix[] = L"ChromeHTML"; +const wchar_t kBrowserProgIdDesc[] = L"Chrome HTML Document"; const wchar_t kCommandExecuteImplUuid[] = L"{5C65F4B0-3651-4514-B207-D10CB699B14B}"; @@ -156,6 +158,14 @@ string16 GoogleChromeDistribution::GetBaseAppId() { return kBrowserAppId; } +string16 GoogleChromeDistribution::GetBrowserProgIdPrefix() { + return kBrowserProgIdPrefix; +} + +string16 GoogleChromeDistribution::GetBrowserProgIdDesc() { + return kBrowserProgIdDesc; +} + string16 GoogleChromeDistribution::GetInstallSubDir() { string16 sub_dir(installer::kGoogleChromeInstallSubDir1); sub_dir.append(L"\\"); diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index a00a31e514..e6bb555c53 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -46,6 +46,10 @@ class GoogleChromeDistribution : public BrowserDistribution { virtual string16 GetBaseAppId() OVERRIDE; + virtual string16 GetBrowserProgIdPrefix() OVERRIDE; + + virtual string16 GetBrowserProgIdDesc() OVERRIDE; + virtual string16 GetInstallSubDir() OVERRIDE; virtual string16 GetPublisherName() OVERRIDE; diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index ff7638a3bb..5c3f7be1e7 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -56,6 +56,16 @@ string16 GoogleChromeDistribution::GetBaseAppId() { return string16(); } +string16 GoogleChromeDistribution::GetBrowserProgIdPrefix() { + NOTREACHED(); + return string16(); +} + +string16 GoogleChromeDistribution::GetBrowserProgIdDesc() { + NOTREACHED(); + return string16(); +} + string16 GoogleChromeDistribution::GetInstallSubDir() { NOTREACHED(); return string16(); diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 1e623d995e..1925f30bcd 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -16,7 +16,11 @@ namespace { const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; const wchar_t kChannelName[] = L"canary"; const wchar_t kBrowserAppId[] = L"ChromeCanary"; +const wchar_t kBrowserProgIdPrefix[] = L"ChromeSSHTM"; +const wchar_t kBrowserProgIdDesc[] = L"Chrome Canary HTML Document"; const int kSxSIconIndex = 4; +const wchar_t kCommandExecuteImplUuid[] = + L"{1BEAC3E3-B852-44F4-B468-8906C062422E}"; // The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc. const int kSxSAppLauncherIconIndex = 6; @@ -53,6 +57,14 @@ string16 GoogleChromeSxSDistribution::GetBaseAppId() { return kBrowserAppId; } +string16 GoogleChromeSxSDistribution::GetBrowserProgIdPrefix() { + return kBrowserProgIdPrefix; +} + +string16 GoogleChromeSxSDistribution::GetBrowserProgIdDesc() { + return kBrowserProgIdDesc; +} + string16 GoogleChromeSxSDistribution::GetInstallSubDir() { return GoogleChromeDistribution::GetInstallSubDir().append( installer::kSxSSuffix); @@ -82,7 +94,9 @@ bool GoogleChromeSxSDistribution::GetChromeChannel(string16* channel) { bool GoogleChromeSxSDistribution::GetCommandExecuteImplClsid( string16* handler_class_uuid) { - return false; + if (handler_class_uuid) + *handler_class_uuid = kCommandExecuteImplUuid; + return true; } bool GoogleChromeSxSDistribution::AppHostIsSupported() { diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index 5261a7accd..d089196a57 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h @@ -23,6 +23,8 @@ class GoogleChromeSxSDistribution : public GoogleChromeDistribution { virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; virtual string16 GetBaseAppId() OVERRIDE; + virtual string16 GetBrowserProgIdPrefix() OVERRIDE; + virtual string16 GetBrowserProgIdDesc() OVERRIDE; virtual string16 GetInstallSubDir() OVERRIDE; virtual string16 GetUninstallRegPath() OVERRIDE; virtual bool CanSetAsDefault() OVERRIDE; diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index c8c037df82..16fac85088 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -365,10 +365,27 @@ bool CheckIsChromeSxSProcess() { PathService::Get(base::DIR_EXE, &exe_dir); string16 chrome_sxs_dir(installer::kGoogleChromeInstallSubDir2); chrome_sxs_dir.append(installer::kSxSSuffix); - return base::FilePath::CompareEqualIgnoreCase( - exe_dir.BaseName().value(), installer::kInstallBinaryDir) && - base::FilePath::CompareEqualIgnoreCase( - exe_dir.DirName().BaseName().value(), chrome_sxs_dir); + + // This is SxS if current EXE is in or under (possibly multiple levels under) + // |chrome_sxs_dir|\|installer::kInstallBinaryDir| + std::vector<base::FilePath::StringType> components; + exe_dir.GetComponents(&components); + // We need at least 1 element in the array for the behavior of the following + // loop to be defined. This should always be true, since we're splitting the + // path to our executable and one of the components will be the drive letter. + DCHECK(!components.empty()); + typedef std::vector<base::FilePath::StringType>::const_reverse_iterator + ComponentsIterator; + for (ComponentsIterator current = components.rbegin(), parent = current + 1; + parent != components.rend(); current = parent++) { + if (base::FilePath::CompareEqualIgnoreCase( + *current, installer::kInstallBinaryDir) && + base::FilePath::CompareEqualIgnoreCase(*parent, chrome_sxs_dir)) { + return true; + } + } + + return false; } bool InstallUtil::IsChromeSxSProcess() { diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 8477b8de81..c74754770c 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -102,7 +102,8 @@ bool IsChromeMetroSupported() { // "ChromeHTML|suffix|"). // |suffix| can be the empty string. string16 GetBrowserProgId(const string16& suffix) { - string16 chrome_html(ShellUtil::kChromeHTMLProgId); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + string16 chrome_html(dist->GetBrowserProgIdPrefix()); chrome_html.append(suffix); // ProgIds cannot be longer than 39 characters. @@ -289,7 +290,7 @@ class RegistryEntry { chrome_html_prog_id.push_back(base::FilePath::kSeparators[0]); chrome_html_prog_id.append(GetBrowserProgId(suffix)); entries->push_back(new RegistryEntry( - chrome_html_prog_id, ShellUtil::kChromeHTMLProgIdDesc)); + chrome_html_prog_id, dist->GetBrowserProgIdDesc())); entries->push_back(new RegistryEntry( chrome_html_prog_id, ShellUtil::kRegUrlProtocol, L"")); entries->push_back(new RegistryEntry( @@ -789,7 +790,7 @@ bool QuickIsChromeRegistered(BrowserDistribution* dist, // Software\Classes\ChromeHTML|suffix| reg_key = ShellUtil::kRegClasses; reg_key.push_back(base::FilePath::kSeparators[0]); - reg_key.append(ShellUtil::kChromeHTMLProgId); + reg_key.append(dist->GetBrowserProgIdPrefix()); reg_key.append(suffix); break; case CONFIRM_SHELL_REGISTRATION: @@ -1058,7 +1059,7 @@ ShellUtil::DefaultState ProbeCurrentDefaultHandlers( NOTREACHED(); return ShellUtil::UNKNOWN_DEFAULT; } - string16 prog_id(ShellUtil::kChromeHTMLProgId); + string16 prog_id(dist->GetBrowserProgIdPrefix()); prog_id += ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe.value()); for (size_t i = 0; i < num_protocols; ++i) { @@ -1353,21 +1354,6 @@ const wchar_t* ShellUtil::kAppPathsRegistryKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"; const wchar_t* ShellUtil::kAppPathsRegistryPathName = L"Path"; -#if defined(GOOGLE_CHROME_BUILD) -const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromeHTML"; -const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chrome HTML Document"; -#else -// This used to be "ChromiumHTML", but was forced to become "ChromiumHTM" -// because of http://crbug.com/153349 as with the '.' and 26 characters suffix -// added on user-level installs, the generated progid for Chromium was 39 -// characters long which, according to MSDN ( -// http://msdn.microsoft.com/library/aa911706.aspx), is the maximum length -// for a progid. It was however determined through experimentation that the 39 -// character limit mentioned on MSDN includes the NULL character... -const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromiumHTM"; -const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chromium HTML Document"; -#endif - const wchar_t* ShellUtil::kDefaultFileAssociations[] = {L".htm", L".html", L".shtml", L".xht", L".xhtml", NULL}; const wchar_t* ShellUtil::kPotentialFileAssociations[] = {L".htm", L".html", @@ -2069,17 +2055,16 @@ bool ShellUtil::RemoveShortcuts(ShellUtil::ShortcutLocation location, } // static -bool ShellUtil::UpdateShortcuts( +bool ShellUtil::UpdateShortcutsWithArgs( ShellUtil::ShortcutLocation location, BrowserDistribution* dist, ShellChange level, const base::FilePath& target_exe, - bool require_args, const ShellUtil::ShortcutProperties& properties) { if (!ShellUtil::ShortcutLocationIsSupported(location)) return true; // Vacuous success. - FilterTargetEq shortcut_filter(target_exe, require_args); + FilterTargetEq shortcut_filter(target_exe, true); ShortcutOperationCallback shortcut_operation( base::Bind(&ShortcutOpUpdate, TranslateShortcutProperties(properties))); return BatchShortcutAction(shortcut_filter.AsShortcutFilterCallback(), diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index bb54f1974e..4c50356adf 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -228,12 +228,6 @@ class ShellUtil { static const wchar_t* kAppPathsRegistryKey; static const wchar_t* kAppPathsRegistryPathName; - // Name that we give to Chrome file association handler ProgId. - static const wchar_t* kChromeHTMLProgId; - - // Description of Chrome file association handler ProgId. - static const wchar_t* kChromeHTMLProgIdDesc; - // Registry path that stores url associations on Vista. static const wchar_t* kRegVistaUrlPrefs; @@ -525,18 +519,17 @@ class ShellUtil { ShellChange level, const base::FilePath& target_exe); - // Applies the updates in |shortcut_properties| to all matching shortcuts - // in |location|, i.e.: + // Applies the updates in |properties| to all matching shortcuts in + // |location|, i.e.: // - the shortcut's original target is |target_exe|, - // - if |require_args| is set, the original arguments are non-empty. + // - the original arguments are non-empty. // Returns true if all updates to matching shortcuts are successful, including // the vacuous case where no matching shortcuts are found. - static bool UpdateShortcuts( + static bool UpdateShortcutsWithArgs( ShellUtil::ShortcutLocation location, BrowserDistribution* dist, ShellChange level, const base::FilePath& target_exe, - bool require_args, const ShellUtil::ShortcutProperties& properties); // Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 29a0723346..b7303e898f 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -434,7 +434,7 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { ASSERT_TRUE(base::PathExists(shortcut1_path.DirName())); } -TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { +TEST_F(ShellUtilShortcutTest, UpdateChromeShortcutsWithArgs) { ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); @@ -448,10 +448,10 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); updated_properties.set_target(new_exe); - - ASSERT_TRUE(ShellUtil::UpdateShortcuts( + // |updated_properties| has arguments. + ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, - chrome_exe_, false, updated_properties)); + chrome_exe_, updated_properties)); ShellUtil::ShortcutProperties expected_properties(test_properties_); expected_properties.set_target(new_exe); @@ -459,7 +459,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { expected_properties); } -TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { +TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcutsWithArgs) { test_properties_.level = ShellUtil::SYSTEM_LEVEL; ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, @@ -475,10 +475,10 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); updated_properties.set_target(new_exe); - - ASSERT_TRUE(ShellUtil::UpdateShortcuts( + // |updated_properties| has arguments. + ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, - chrome_exe_, false, updated_properties)); + chrome_exe_, updated_properties)); ShellUtil::ShortcutProperties expected_properties(test_properties_); expected_properties.set_target(new_exe); @@ -486,7 +486,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { expected_properties); } -TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { +TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcutsWithArgs) { const wchar_t kShortcutName1[] = L"Chrome 1"; const wchar_t kShortcutName2[] = L"Chrome 2"; @@ -519,11 +519,10 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); updated_properties.set_target(new_exe); - // |require_args| = true, so only changing shrotcuts that have non-empty - // arguments; only shortcut 2 is updated. - ASSERT_TRUE(ShellUtil::UpdateShortcuts( + // Only changing shrotcuts that have non-empty arguments, i.e., shortcut 2. + ASSERT_TRUE(ShellUtil::UpdateShortcutsWithArgs( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, - chrome_exe_, /*require_args*/ true, updated_properties)); + chrome_exe_, updated_properties)); // Verify shortcut 1. // |expected_properties1| was unchanged and still targets "chrome.exe", since // it has empty target, yet we passed |require_args| = true. @@ -533,18 +532,6 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { expected_properties2.set_target(new_exe); ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, expected_properties2); - - // |require_args| = false, now both shortcuts are updated. - ASSERT_TRUE(ShellUtil::UpdateShortcuts( - ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, - chrome_exe_, /*require_args*/ false, updated_properties)); - // Verify shortcut 1. - expected_properties1.set_target(new_exe); - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties1); - // Verify shortcut 2. - ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, - expected_properties2); } TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { |