summaryrefslogtreecommitdiff
path: root/chrome/installer
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-09-12 12:10:22 +0100
committerTorne (Richard Coles) <torne@google.com>2013-09-12 12:10:22 +0100
commit58537e28ecd584eab876aee8be7156509866d23a (patch)
tree8988984e52090aaadf33cff139d7dd212cd13656 /chrome/installer
parent0a1b11dee8e5cb2520121c300858fea6138e3c54 (diff)
downloadchromium_org-58537e28ecd584eab876aee8be7156509866d23a.tar.gz
Merge from Chromium at DEPS revision 222756
This commit was generated by merge_to_master.py. Change-Id: I40d7f32f195f328f005f230ea80d07092d48040e
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/OWNERS4
-rw-r--r--chrome/installer/mini_installer.gyp2
-rw-r--r--chrome/installer/mini_installer.gypi2
-rw-r--r--chrome/installer/mini_installer/chrome.release1
-rw-r--r--chrome/installer/setup/install_unittest.cc2
-rw-r--r--chrome/installer/setup/uninstall.cc70
-rw-r--r--chrome/installer/util/master_preferences.cc2
-rw-r--r--chrome/installer/util/shell_util.cc27
-rw-r--r--chrome/installer/util/shell_util.h11
-rw-r--r--chrome/installer/util/shell_util_unittest.cc32
10 files changed, 125 insertions, 28 deletions
diff --git a/chrome/installer/OWNERS b/chrome/installer/OWNERS
index 31b69bffbf..467f5eba8c 100644
--- a/chrome/installer/OWNERS
+++ b/chrome/installer/OWNERS
@@ -2,3 +2,7 @@ gab@chromium.org
grt@chromium.org
robertshield@chromium.org
tommi@chromium.org
+
+# Syzygy files.
+per-file mini_installer_syzygy.gyp=chrisha@chromium.org
+per-file mini_installer_syzygy.gyp=siggi@chromium.org
diff --git a/chrome/installer/mini_installer.gyp b/chrome/installer/mini_installer.gyp
index 5f84d34f1e..d0d680f5bc 100644
--- a/chrome/installer/mini_installer.gyp
+++ b/chrome/installer/mini_installer.gyp
@@ -16,7 +16,6 @@
['OS=="win"', {
'target_defaults': {
'dependencies': [
- '../chrome.gyp:app_host',
'../chrome.gyp:chrome',
'../chrome.gyp:chrome_nacl_win64',
'../chrome.gyp:chrome_dll',
@@ -250,7 +249,6 @@
],
'inputs': [
'<(create_installer_archive_py_path)',
- '<(PRODUCT_DIR)/app_host.exe',
'<(PRODUCT_DIR)/chrome.exe',
'<(PRODUCT_DIR)/chrome.dll',
'<(PRODUCT_DIR)/nacl64.exe',
diff --git a/chrome/installer/mini_installer.gypi b/chrome/installer/mini_installer.gypi
index 78d90ff7cc..5b1e9eb691 100644
--- a/chrome/installer/mini_installer.gypi
+++ b/chrome/installer/mini_installer.gypi
@@ -4,7 +4,6 @@
{
'dependencies': [
'<@(chrome_dll_project)',
- '../chrome.gyp:app_host',
'../chrome.gyp:chrome',
'../chrome.gyp:chrome_nacl_win64',
'../chrome.gyp:default_extensions',
@@ -189,7 +188,6 @@
],
'inputs': [
'<(create_installer_archive_py_path)',
- '<(PRODUCT_DIR)/app_host.exe',
'<(PRODUCT_DIR)/chrome.exe',
'<@(chrome_dll_path)',
'<(PRODUCT_DIR)/nacl64.exe',
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index 5286b3a33e..3f7e739f0e 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -3,7 +3,6 @@
# found in the LICENSE file.
[GENERAL]
-app_host.exe: %(ChromeDir)s\
chrome.exe: %(ChromeDir)s\
wow_helper.exe: %(ChromeDir)s\
asan_rtl.dll: %(VersionDir)s\
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc
index 40f6ab1c79..5f9010586f 100644
--- a/chrome/installer/setup/install_unittest.cc
+++ b/chrome/installer/setup/install_unittest.cc
@@ -235,7 +235,7 @@ TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) {
ASSERT_TRUE(base::PathExists(manifest_path_));
std::string read_manifest;
- ASSERT_TRUE(file_util::ReadFileToString(manifest_path_, &read_manifest));
+ ASSERT_TRUE(base::ReadFileToString(manifest_path_, &read_manifest));
static const char kExpectedManifest[] =
"<Application>\r\n"
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 7f8e7cebb3..8693dfa834 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -328,6 +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) {
+ 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);
+
+ VLOG(1) << "Retargeting Desktop shortcuts.";
+ if (!ShellUtil::UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist,
+ install_level, old_target_exe, require_args,
+ 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)) {
+ 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)) {
+ 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)) {
+ 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)) {
+ LOG(WARNING) << "Failed to retarget start-screen shortcuts.";
+ }
+}
+
// Deletes shortcuts at |install_level| from Start menu, Desktop,
// Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+).
// Only shortcuts pointing to |target_exe| will be removed.
@@ -1136,6 +1186,26 @@ 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 (cmd_line.HasSwitch(installer::switches::kSelfDestruct) &&
+ !installer_state.system_install()) {
+ const base::FilePath system_chrome_path(
+ GetChromeInstallPath(true, browser_dist).
+ 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);
+ } else {
+ VLOG(1) << "Retarget failed: system-level Chrome not found.";
+ }
+ }
+
DeleteShortcuts(installer_state, product, base::FilePath(chrome_exe));
} else if (product.is_chrome_app_host()) {
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index d345e95c63..0895c8326c 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -102,7 +102,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path)
// and the remainder of this MasterPreferences object should still be
// initialized as best as possible.
if (base::PathExists(prefs_path) &&
- !file_util::ReadFileToString(prefs_path, &json_data)) {
+ !base::ReadFileToString(prefs_path, &json_data)) {
LOG(ERROR) << "Failed to read preferences from " << prefs_path.value();
}
if (InitializeFromString(json_data))
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index a5122d50ad..8477b8de81 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1203,13 +1203,15 @@ typedef base::Callback<bool(const base::FilePath& /*shortcut_path*/,
ShortcutFilterCallback;
// FilterTargetEq is a shortcut filter that matches only shortcuts that have a
-// specific target.
+// specific target, and optionally matches shortcuts that have non-empty
+// arguments.
class FilterTargetEq {
public:
- explicit FilterTargetEq(const base::FilePath& desired_target_exe);
+ FilterTargetEq(const base::FilePath& desired_target_exe, bool require_args);
// Returns true if filter rules are satisfied, i.e.:
- // - |target_path| matches |desired_target_compare_|.
+ // - |target_path|'s target == |desired_target_compare_|, and
+ // - |args| is non-empty (if |require_args_| == true).
bool Match(const base::FilePath& target_path, const string16& args) const;
// A convenience routine to create a callback to call Match().
@@ -1219,14 +1221,22 @@ class FilterTargetEq {
private:
InstallUtil::ProgramCompare desired_target_compare_;
+
+ bool require_args_;
};
-FilterTargetEq::FilterTargetEq(const base::FilePath& desired_target_exe)
- : desired_target_compare_(desired_target_exe) {}
+FilterTargetEq::FilterTargetEq(const base::FilePath& desired_target_exe,
+ bool require_args)
+ : desired_target_compare_(desired_target_exe),
+ require_args_(require_args) {}
bool FilterTargetEq::Match(const base::FilePath& target_path,
const string16& args) const {
- return desired_target_compare_.EvaluatePath(target_path);
+ if (!desired_target_compare_.EvaluatePath(target_path))
+ return false;
+ if (require_args_ && args.empty())
+ return false;
+ return true;
}
ShortcutFilterCallback FilterTargetEq::AsShortcutFilterCallback() {
@@ -2042,7 +2052,7 @@ bool ShellUtil::RemoveShortcuts(ShellUtil::ShortcutLocation location,
if (!ShellUtil::ShortcutLocationIsSupported(location))
return true; // Vacuous success.
- FilterTargetEq shortcut_filter(target_exe);
+ FilterTargetEq shortcut_filter(target_exe, false);
// Main operation to apply to each shortcut in the directory specified.
ShortcutOperationCallback shortcut_operation(
location == SHORTCUT_LOCATION_TASKBAR_PINS ?
@@ -2064,11 +2074,12 @@ bool ShellUtil::UpdateShortcuts(
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);
+ FilterTargetEq shortcut_filter(target_exe, require_args);
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 7d42c3c839..bb54f1974e 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -525,15 +525,18 @@ class ShellUtil {
ShellChange level,
const base::FilePath& target_exe);
- // Applies the updates in |shortcut_properties| to all shortcuts in |location|
- // that target |target_exe|.
- // Returns true if all shortcuts pointing to |target_exe| are successfully
- // updated, including the case where no such shortcuts are found.
+ // Applies the updates in |shortcut_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.
+ // Returns true if all updates to matching shortcuts are successful, including
+ // the vacuous case where no matching shortcuts are found.
static bool UpdateShortcuts(
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 4000813127..29a0723346 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -451,7 +451,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
ASSERT_TRUE(ShellUtil::UpdateShortcuts(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, updated_properties));
+ chrome_exe_, false, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -478,7 +478,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
ASSERT_TRUE(ShellUtil::UpdateShortcuts(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL,
- chrome_exe_, updated_properties));
+ chrome_exe_, false, updated_properties));
ShellUtil::ShortcutProperties expected_properties(test_properties_);
expected_properties.set_target(new_exe);
@@ -490,18 +490,18 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
const wchar_t kShortcutName1[] = L"Chrome 1";
const wchar_t kShortcutName2[] = L"Chrome 2";
- // Setup shortcut 1.
+ // Setup shortcut 1, which has empty arguments.
test_properties_.set_shortcut_name(kShortcutName1);
+ test_properties_.set_arguments(L"");
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
- string16 shortcut1_name(
- string16(kShortcutName1).append(installer::kLnkExt));
+ string16 shortcut1_name(string16(kShortcutName1).append(installer::kLnkExt));
base::FilePath shortcut1_path(
fake_user_desktop_.path().Append(shortcut1_name));
ShellUtil::ShortcutProperties expected_properties1(test_properties_);
- // Setup shortcut 2, which also has arguments.
+ // Setup shortcut 2, which has non-empty arguments.
string16 shortcut2_args = L"--profile-directory=\"Profile 2\"";
test_properties_.set_shortcut_name(kShortcutName2);
test_properties_.set_arguments(shortcut2_args);
@@ -518,17 +518,31 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
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(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
- chrome_exe_, updated_properties));
+ chrome_exe_, /*require_args*/ true, 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.
+ ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
+ expected_properties1);
+ // Verify shortcut 2.
+ 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.
- expected_properties2.set_target(new_exe);
ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
expected_properties2);
}