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

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

Issue 11267023: Implementing --app-launcher install/uninstall flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing shortcut install (will do in different CL), but keeping some refactoring. Created 8 years, 1 month 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 | Annotate | Revision Log
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 <shlobj.h> 7 #include <shlobj.h>
8 #include <time.h> 8 #include <time.h>
9 #include <winuser.h> 9 #include <winuser.h>
10 10
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 void CreateOrUpdateShortcuts(const InstallerState& installer_state, 344 void CreateOrUpdateShortcuts(const InstallerState& installer_state,
345 const FilePath& setup_exe, 345 const FilePath& setup_exe,
346 const Product& product, 346 const Product& product,
347 InstallShortcutOperation install_operation, 347 InstallShortcutOperation install_operation,
348 bool alternate_desktop_shortcut) { 348 bool alternate_desktop_shortcut) {
349 // TODO(tommi): Change this function to use WorkItemList. 349 // TODO(tommi): Change this function to use WorkItemList.
350 DCHECK(product.is_chrome()); 350 DCHECK(product.is_chrome());
351 351
352 BrowserDistribution* dist = product.distribution(); 352 BrowserDistribution* dist = product.distribution();
353 const FilePath chrome_exe(
354 installer_state.target_path().Append(installer::kChromeExe));
355 ShellUtil::ShellChange install_level = 353 ShellUtil::ShellChange install_level =
356 installer_state.system_install() ? ShellUtil::SYSTEM_LEVEL : 354 installer_state.system_install() ? ShellUtil::SYSTEM_LEVEL :
357 ShellUtil::CURRENT_USER; 355 ShellUtil::CURRENT_USER;
356 // |base_properties|: The basic properties to set on every shortcut installed
grt (UTC plus 2) 2012/10/30 13:02:55 please revert all shortcut-related changes if you'
erikwright (departed) 2012/10/30 14:20:39 Feel free to ask for help to split them into a sep
huangs 2012/10/30 20:35:07 Will remove the "if". The rest is just minor clea
gab 2012/10/30 21:30:40 I don't see how the changes in install.cc/uninstal
huangs 2012/10/30 21:38:39 I didn't want these trivial changes to add visual
erikwright (departed) 2012/10/30 22:53:52 If the changes are good refactorings that stand on
357 // (to be refined on a per-shortcut basis).
358 ShellUtil::ChromeShortcutProperties base_properties(install_level);
359
360 if (product.is_chrome()) {
361 base_properties.set_chrome_exe(
362 installer_state.target_path().Append(installer::kChromeExe));
363 }
358 364
359 // The default operation on update is to overwrite shortcuts with the 365 // The default operation on update is to overwrite shortcuts with the
360 // currently desired properties, but do so only for shortcuts that still 366 // currently desired properties, but do so only for shortcuts that still
361 // exist. 367 // exist.
362 ShellUtil::ChromeShortcutOperation shortcut_operation = 368 ShellUtil::ChromeShortcutOperation shortcut_operation =
363 ShellUtil::SHORTCUT_REPLACE_EXISTING; 369 ShellUtil::SHORTCUT_REPLACE_EXISTING;
364
365 // |base_properties|: The basic properties to set on every shortcut installed
366 // (to be refined on a per-shortcut basis).
367 ShellUtil::ChromeShortcutProperties base_properties(install_level);
368 base_properties.set_chrome_exe(chrome_exe);
369
370 // If |install_operation| is INSTALL_SHORTCUT_CREATE_ALL, create optional 370 // If |install_operation| is INSTALL_SHORTCUT_CREATE_ALL, create optional
371 // shortcuts (Desktop and Quick Launch) immediately; otherwise delay their 371 // shortcuts (Desktop and Quick Launch) immediately; otherwise delay their
372 // creation until first run. 372 // creation until first run.
373 if (install_operation == INSTALL_SHORTCUT_CREATE_ALL) 373 if (install_operation == INSTALL_SHORTCUT_CREATE_ALL)
374 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS; 374 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS;
375 375
376 ShellUtil::ChromeShortcutProperties desktop_properties(base_properties); 376 ShellUtil::ChromeShortcutProperties desktop_properties(base_properties);
377 if (alternate_desktop_shortcut) 377 if (alternate_desktop_shortcut)
378 desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName()); 378 desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName());
379 ExecuteAndLogShortcutOperation( 379 ExecuteAndLogShortcutOperation(
(...skipping 14 matching lines...) Expand all
394 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, user_ql_properties, 394 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, user_ql_properties,
395 shortcut_operation); 395 shortcut_operation);
396 } 396 }
397 397
398 // Turn on shortcut creation for mandatory shortcuts if requested. 398 // Turn on shortcut creation for mandatory shortcuts if requested.
399 if (install_operation == INSTALL_SHORTCUT_CREATE_MANDATORY) 399 if (install_operation == INSTALL_SHORTCUT_CREATE_MANDATORY)
400 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS; 400 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS;
401 401
402 ShellUtil::ChromeShortcutProperties start_menu_properties(base_properties); 402 ShellUtil::ChromeShortcutProperties start_menu_properties(base_properties);
403 // IMPORTANT: Only the default (no arguments and default browserappid) browser 403 // IMPORTANT: Only the default (no arguments and default browserappid) browser
404 // shortcut in the Start menu (Start screen on Win8+) should be made dual 404 // shortcut in the Start menu (Start screen on Win8+) should be made dual
405 // mode. 405 // mode.
406 start_menu_properties.set_dual_mode(true); 406 start_menu_properties.set_dual_mode(true);
407 if (shortcut_operation == ShellUtil::SHORTCUT_CREATE_ALWAYS) 407 if (shortcut_operation == ShellUtil::SHORTCUT_CREATE_ALWAYS)
408 start_menu_properties.set_pin_to_taskbar(true); 408 start_menu_properties.set_pin_to_taskbar(true);
409 ExecuteAndLogShortcutOperation( 409 ExecuteAndLogShortcutOperation(
410 ShellUtil::SHORTCUT_START_MENU, dist, start_menu_properties, 410 ShellUtil::SHORTCUT_START_MENU, dist, start_menu_properties,
411 shortcut_operation); 411 shortcut_operation);
412 } 412 }
413 413
414 void RegisterChromeOnMachine(const InstallerState& installer_state, 414 void RegisterChromeOnMachine(const InstallerState& installer_state,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 586 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
587 VLOG(1) << "Updating and registering shortcuts."; 587 VLOG(1) << "Updating and registering shortcuts.";
588 CreateOrUpdateShortcuts( 588 CreateOrUpdateShortcuts(
589 installer_state, setup_exe, chrome, INSTALL_SHORTCUT_REPLACE_EXISTING, 589 installer_state, setup_exe, chrome, INSTALL_SHORTCUT_REPLACE_EXISTING,
590 false); 590 false);
591 RegisterChromeOnMachine(installer_state, chrome, false); 591 RegisterChromeOnMachine(installer_state, chrome, false);
592 } 592 }
593 } 593 }
594 594
595 } // namespace installer 595 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698