OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/installer/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 return installer::NEW_VERSION_UPDATED; | 237 return installer::NEW_VERSION_UPDATED; |
238 } | 238 } |
239 | 239 |
240 LOG(ERROR) << "Not sure how we got here while updating" | 240 LOG(ERROR) << "Not sure how we got here while updating" |
241 << ", new version: " << new_version.GetString() | 241 << ", new version: " << new_version.GetString() |
242 << ", old version: " << (*current_version)->GetString(); | 242 << ", old version: " << (*current_version)->GetString(); |
243 | 243 |
244 return installer::INSTALL_FAILED; | 244 return installer::INSTALL_FAILED; |
245 } | 245 } |
246 | 246 |
247 // Deletes the old "Uninstall Google Chrome" shortcut in the Start menu and, if | |
248 // this is a system-level install, also deletes the old Default user Quick | |
249 // Launch shortcut. Both of these were created prior to Chrome 24; in Chrome 24, | |
250 // the uninstall shortcut was removed and the Default user Quick Launch shortcut | |
251 // was replaced by per-user shortcuts created via Active Setup. | |
252 void CleanupLegacyShortcuts(const installer::InstallerState& installer_state, | |
grt (UTC plus 2)
2014/08/04 18:27:08
this is still run on a surprising number of update
gab
2014/08/04 18:57:08
Why do you think this is the case? Google Update d
grt (UTC plus 2)
2014/08/04 19:05:51
If there is a policy for this (I'm not aware of on
gab
2014/08/04 20:22:51
This is what we do in prefs when deprecating prefs
| |
253 BrowserDistribution* dist, | |
254 const base::FilePath& chrome_exe) { | |
255 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? | |
256 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | |
257 base::FilePath uninstall_shortcut_path; | |
258 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | |
259 dist, shortcut_level, &uninstall_shortcut_path); | |
260 uninstall_shortcut_path = uninstall_shortcut_path.Append( | |
261 dist->GetUninstallLinkName() + installer::kLnkExt); | |
262 base::DeleteFile(uninstall_shortcut_path, false); | |
263 | |
264 if (installer_state.system_install()) { | |
265 ShellUtil::RemoveShortcuts( | |
266 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, | |
267 ShellUtil::SYSTEM_LEVEL, chrome_exe); | |
268 } | |
269 } | |
270 | |
271 // Returns the appropriate shortcut operations for App Launcher, | 247 // Returns the appropriate shortcut operations for App Launcher, |
272 // based on state of installation and master_preferences. | 248 // based on state of installation and master_preferences. |
273 installer::InstallShortcutOperation GetAppLauncherShortcutOperation( | 249 installer::InstallShortcutOperation GetAppLauncherShortcutOperation( |
274 const installer::InstallationState& original_state, | 250 const installer::InstallationState& original_state, |
275 const installer::InstallerState& installer_state) { | 251 const installer::InstallerState& installer_state) { |
276 const installer::ProductState* original_app_host_state = | 252 const installer::ProductState* original_app_host_state = |
277 original_state.GetProductState(installer_state.system_install(), | 253 original_state.GetProductState(installer_state.system_install(), |
278 BrowserDistribution::CHROME_APP_HOST); | 254 BrowserDistribution::CHROME_APP_HOST); |
279 bool app_launcher_exists = original_app_host_state && | 255 bool app_launcher_exists = original_app_host_state && |
280 original_app_host_state->uninstall_command() | 256 original_app_host_state->uninstall_command() |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 CURRENT_USER, app_launcher_shortcut_operation); | 531 CURRENT_USER, app_launcher_shortcut_operation); |
556 } | 532 } |
557 | 533 |
558 const installer::Product* chrome_product = | 534 const installer::Product* chrome_product = |
559 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); | 535 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); |
560 // Creates shortcuts for Chrome. | 536 // Creates shortcuts for Chrome. |
561 if (chrome_product) { | 537 if (chrome_product) { |
562 BrowserDistribution* chrome_dist = chrome_product->distribution(); | 538 BrowserDistribution* chrome_dist = chrome_product->distribution(); |
563 const base::FilePath chrome_exe( | 539 const base::FilePath chrome_exe( |
564 installer_state.target_path().Append(kChromeExe)); | 540 installer_state.target_path().Append(kChromeExe)); |
565 CleanupLegacyShortcuts(installer_state, chrome_dist, chrome_exe); | |
566 | 541 |
567 // Install per-user shortcuts on user-level installs and all-users | 542 // Install per-user shortcuts on user-level installs and all-users |
568 // shortcuts on system-level installs. Note that Active Setup will take | 543 // shortcuts on system-level installs. Note that Active Setup will take |
569 // care of installing missing per-user shortcuts on system-level install | 544 // care of installing missing per-user shortcuts on system-level install |
570 // (i.e., quick launch, taskbar pin, and possibly deleted all-users | 545 // (i.e., quick launch, taskbar pin, and possibly deleted all-users |
571 // shortcuts). | 546 // shortcuts). |
572 InstallShortcutLevel install_level = installer_state.system_install() ? | 547 InstallShortcutLevel install_level = installer_state.system_install() ? |
573 ALL_USERS : CURRENT_USER; | 548 ALL_USERS : CURRENT_USER; |
574 | 549 |
575 InstallShortcutOperation install_operation = | 550 InstallShortcutOperation install_operation = |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 657 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
683 | 658 |
684 // Read master_preferences copied beside chrome.exe at install. | 659 // Read master_preferences copied beside chrome.exe at install. |
685 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 660 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
686 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 661 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
687 CreateOrUpdateShortcuts( | 662 CreateOrUpdateShortcuts( |
688 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 663 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
689 } | 664 } |
690 | 665 |
691 } // namespace installer | 666 } // namespace installer |
OLD | NEW |