Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/installer/setup/install.cc

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update .gn file; remove TODO's. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ? 251 ShellUtil::ShellChange shortcut_level = installer_state.system_install() ?
252 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; 252 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
253 base::FilePath uninstall_shortcut_path; 253 base::FilePath uninstall_shortcut_path;
254 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, 254 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
255 dist, shortcut_level, &uninstall_shortcut_path); 255 dist, shortcut_level, &uninstall_shortcut_path);
256 uninstall_shortcut_path = uninstall_shortcut_path.Append( 256 uninstall_shortcut_path = uninstall_shortcut_path.Append(
257 dist->GetUninstallLinkName() + installer::kLnkExt); 257 dist->GetUninstallLinkName() + installer::kLnkExt);
258 base::DeleteFile(uninstall_shortcut_path, false); 258 base::DeleteFile(uninstall_shortcut_path, false);
259 } 259 }
260 260
261 // Returns the appropriate shortcut operations for App Launcher,
262 // based on state of installation and master_preferences.
263 installer::InstallShortcutOperation GetAppLauncherShortcutOperation(
264 const installer::InstallationState& original_state,
265 const installer::InstallerState& installer_state) {
266 const installer::ProductState* original_app_host_state =
267 original_state.GetProductState(installer_state.system_install(),
268 BrowserDistribution::CHROME_APP_HOST);
269 bool app_launcher_exists = original_app_host_state &&
270 original_app_host_state->uninstall_command()
271 .HasSwitch(installer::switches::kChromeAppLauncher);
272 if (!app_launcher_exists)
273 return installer::INSTALL_SHORTCUT_CREATE_ALL;
274
275 return installer::INSTALL_SHORTCUT_REPLACE_EXISTING;
276 }
277
278 } // end namespace 261 } // end namespace
279 262
280 namespace installer { 263 namespace installer {
281 264
282 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { 265 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) {
283 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), 266 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"),
284 base::ASCIIToUTF16("&amp;"), att_value); 267 base::ASCIIToUTF16("&amp;"), att_value);
285 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"), 268 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"),
286 base::ASCIIToUTF16("&apos;"), att_value); 269 base::ASCIIToUTF16("&apos;"), att_value);
287 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"), 270 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"),
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // installed and for the binaries in case of multi-install. 505 // installed and for the binaries in case of multi-install.
523 installer_state.UpdateChannels(); 506 installer_state.UpdateChannels();
524 507
525 installer_state.UpdateStage(installer::COPYING_PREFERENCES_FILE); 508 installer_state.UpdateStage(installer::COPYING_PREFERENCES_FILE);
526 509
527 if (result == FIRST_INSTALL_SUCCESS && !prefs_path.empty()) 510 if (result == FIRST_INSTALL_SUCCESS && !prefs_path.empty())
528 CopyPreferenceFileForFirstRun(installer_state, prefs_path); 511 CopyPreferenceFileForFirstRun(installer_state, prefs_path);
529 512
530 installer_state.UpdateStage(installer::CREATING_SHORTCUTS); 513 installer_state.UpdateStage(installer::CREATING_SHORTCUTS);
531 514
532 const installer::Product* app_launcher_product =
533 installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST);
534 // Creates shortcuts for App Launcher.
535 if (app_launcher_product) {
536 // TODO(huangs): Remove this check once we have system-level App Host.
537 DCHECK(!installer_state.system_install());
538 const base::FilePath app_host_exe(
539 installer_state.target_path().Append(kChromeAppHostExe));
540 InstallShortcutOperation app_launcher_shortcut_operation =
541 GetAppLauncherShortcutOperation(original_state, installer_state);
542
543 // Always install per-user shortcuts for App Launcher.
544 CreateOrUpdateShortcuts(app_host_exe, *app_launcher_product, prefs,
545 CURRENT_USER, app_launcher_shortcut_operation);
546 }
547
548 const installer::Product* chrome_product = 515 const installer::Product* chrome_product =
549 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); 516 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
550 // Creates shortcuts for Chrome. 517 // Creates shortcuts for Chrome.
551 if (chrome_product) { 518 if (chrome_product) {
552 BrowserDistribution* chrome_dist = chrome_product->distribution(); 519 BrowserDistribution* chrome_dist = chrome_product->distribution();
553 const base::FilePath chrome_exe( 520 const base::FilePath chrome_exe(
554 installer_state.target_path().Append(kChromeExe)); 521 installer_state.target_path().Append(kChromeExe));
555 CleanupLegacyShortcuts(installer_state, chrome_dist, chrome_exe); 522 CleanupLegacyShortcuts(installer_state, chrome_dist, chrome_exe);
556 523
557 // Install per-user shortcuts on user-level installs and all-users 524 // Install per-user shortcuts on user-level installs and all-users
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); 639 INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL);
673 640
674 // Read master_preferences copied beside chrome.exe at install. 641 // Read master_preferences copied beside chrome.exe at install.
675 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 642 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
676 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 643 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
677 CreateOrUpdateShortcuts( 644 CreateOrUpdateShortcuts(
678 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 645 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
679 } 646 }
680 647
681 } // namespace installer 648 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698