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 | 247 // Deletes the old "Uninstall Google Chrome" shortcut in the Start menu which |
248 // this is a system-level install, also deletes the old Default user Quick | 248 // was installed prior to Chrome 24. |
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, | 249 void CleanupLegacyShortcuts(const installer::InstallerState& installer_state, |
253 BrowserDistribution* dist, | 250 BrowserDistribution* dist, |
254 const base::FilePath& chrome_exe) { | 251 const base::FilePath& chrome_exe) { |
255 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? | 252 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? |
256 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; | 253 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; |
257 base::FilePath uninstall_shortcut_path; | 254 base::FilePath uninstall_shortcut_path; |
258 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | 255 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, |
259 dist, shortcut_level, &uninstall_shortcut_path); | 256 dist, shortcut_level, &uninstall_shortcut_path); |
260 uninstall_shortcut_path = uninstall_shortcut_path.Append( | 257 uninstall_shortcut_path = uninstall_shortcut_path.Append( |
261 dist->GetUninstallLinkName() + installer::kLnkExt); | 258 dist->GetUninstallLinkName() + installer::kLnkExt); |
262 base::DeleteFile(uninstall_shortcut_path, false); | 259 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 } | 260 } |
270 | 261 |
271 // Returns the appropriate shortcut operations for App Launcher, | 262 // Returns the appropriate shortcut operations for App Launcher, |
272 // based on state of installation and master_preferences. | 263 // based on state of installation and master_preferences. |
273 installer::InstallShortcutOperation GetAppLauncherShortcutOperation( | 264 installer::InstallShortcutOperation GetAppLauncherShortcutOperation( |
274 const installer::InstallationState& original_state, | 265 const installer::InstallationState& original_state, |
275 const installer::InstallerState& installer_state) { | 266 const installer::InstallerState& installer_state) { |
276 const installer::ProductState* original_app_host_state = | 267 const installer::ProductState* original_app_host_state = |
277 original_state.GetProductState(installer_state.system_install(), | 268 original_state.GetProductState(installer_state.system_install(), |
278 BrowserDistribution::CHROME_APP_HOST); | 269 BrowserDistribution::CHROME_APP_HOST); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 673 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
683 | 674 |
684 // Read master_preferences copied beside chrome.exe at install. | 675 // Read master_preferences copied beside chrome.exe at install. |
685 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 676 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
686 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 677 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
687 CreateOrUpdateShortcuts( | 678 CreateOrUpdateShortcuts( |
688 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 679 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
689 } | 680 } |
690 | 681 |
691 } // namespace installer | 682 } // namespace installer |
OLD | NEW |