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

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

Issue 10836247: Refactor ShellUtil shortcut code -- single multi-purpose methods as opposed to many slighlty diffe… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respect microsoft's definition of correct C++ Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install.h ('k') | chrome/installer/setup/install_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include <string>
12
11 #include "base/command_line.h" 13 #include "base/command_line.h"
12 #include "base/file_path.h" 14 #include "base/file_path.h"
13 #include "base/file_util.h" 15 #include "base/file_util.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
16 #include "base/path_service.h" 18 #include "base/path_service.h"
17 #include "base/string_util.h" 19 #include "base/string_util.h"
18 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
19 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
20 #include "base/win/shortcut.h" 22 #include "base/win/shortcut.h"
21 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
22 #include "chrome/common/chrome_constants.h" 24 #include "chrome/common/chrome_constants.h"
23 #include "chrome/installer/setup/setup_constants.h" 25 #include "chrome/installer/setup/setup_constants.h"
24 #include "chrome/installer/setup/install_worker.h" 26 #include "chrome/installer/setup/install_worker.h"
25 #include "chrome/installer/util/auto_launch_util.h" 27 #include "chrome/installer/util/auto_launch_util.h"
26 #include "chrome/installer/util/browser_distribution.h" 28 #include "chrome/installer/util/browser_distribution.h"
27 #include "chrome/installer/util/create_reg_key_work_item.h" 29 #include "chrome/installer/util/create_reg_key_work_item.h"
28 #include "chrome/installer/util/delete_after_reboot_helper.h" 30 #include "chrome/installer/util/delete_after_reboot_helper.h"
29 #include "chrome/installer/util/google_update_constants.h" 31 #include "chrome/installer/util/google_update_constants.h"
30 #include "chrome/installer/util/helper.h" 32 #include "chrome/installer/util/helper.h"
31 #include "chrome/installer/util/install_util.h" 33 #include "chrome/installer/util/install_util.h"
34 #include "chrome/installer/util/master_preferences.h"
32 #include "chrome/installer/util/master_preferences_constants.h" 35 #include "chrome/installer/util/master_preferences_constants.h"
33 #include "chrome/installer/util/set_reg_value_work_item.h" 36 #include "chrome/installer/util/set_reg_value_work_item.h"
34 #include "chrome/installer/util/shell_util.h" 37 #include "chrome/installer/util/shell_util.h"
38 #include "chrome/installer/util/util_constants.h"
35 #include "chrome/installer/util/work_item_list.h" 39 #include "chrome/installer/util/work_item_list.h"
36 40
37 // Build-time generated include file. 41 // Build-time generated include file.
38 #include "registered_dlls.h" // NOLINT 42 #include "registered_dlls.h" // NOLINT
39 43
40 using installer::InstallerState; 44 using installer::InstallerState;
41 using installer::InstallationState; 45 using installer::InstallationState;
42 using installer::Product; 46 using installer::Product;
43 47
44 namespace { 48 namespace {
45 49
50 void LogShortcutOperation(ShellUtil::ChromeShortcutLocation location,
51 BrowserDistribution* dist,
52 const ShellUtil::ChromeShortcutProperties& properties,
53 ShellUtil::ChromeShortcutOperation operation,
54 bool failed) {
55 // SHORTCUT_UPDATE_EXISTING should not be used at install and thus this method
56 // does not handle logging a message for it.
57 DCHECK(operation != ShellUtil::SHORTCUT_UPDATE_EXISTING);
58 std::string message;
59 if (failed)
60 message.append("Failed: ");
61 message.append(operation == ShellUtil::SHORTCUT_CREATE_ALWAYS ?
62 "Creating " : "Overwriting ");
63 if (failed && operation == ShellUtil::SHORTCUT_REPLACE_EXISTING)
64 message.append("(maybe the shortcut doesn't exist?) ");
65 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " :
66 "all-users ");
67 switch (location) {
68 case ShellUtil::SHORTCUT_DESKTOP:
69 message.append("Desktop ");
70 break;
71 case ShellUtil::SHORTCUT_QUICK_LAUNCH:
72 message.append("Quick Launch ");
73 break;
74 case ShellUtil::SHORTCUT_START_MENU:
75 message.append("Start menu ");
76 break;
77 default:
78 NOTREACHED();
79 }
80
81 message.push_back('"');
82 if (properties.has_shortcut_name())
83 message.append(UTF16ToUTF8(properties.shortcut_name));
84 else
85 message.append(UTF16ToUTF8(dist->GetAppShortCutName()));
86 message.push_back('"');
87
88 message.append(" shortcut to ");
89 message.append(UTF16ToUTF8(properties.chrome_exe.value()));
90 if (properties.has_arguments())
91 message.append(UTF16ToUTF8(properties.arguments));
92
93 if (properties.pin_to_taskbar &&
94 base::win::GetVersion() >= base::win::VERSION_WIN7) {
95 message.append(" and pinning to the taskbar.");
96 } else {
97 message.push_back('.');
98 }
99
100 if (failed)
101 LOG(WARNING) << message;
102 else
103 VLOG(1) << message;
104 }
105
106 void ExecuteAndLogShortcutOperation(
107 ShellUtil::ChromeShortcutLocation location,
108 BrowserDistribution* dist,
109 const ShellUtil::ChromeShortcutProperties& properties,
110 ShellUtil::ChromeShortcutOperation operation) {
111 LogShortcutOperation(location, dist, properties, operation, false);
112 if (!ShellUtil::CreateOrUpdateChromeShortcut(location, dist, properties,
113 operation)) {
114 LogShortcutOperation(location, dist, properties, operation, true);
115 }
116 }
117
46 void AddChromeToMediaPlayerList() { 118 void AddChromeToMediaPlayerList() {
47 string16 reg_path(installer::kMediaPlayerRegPath); 119 string16 reg_path(installer::kMediaPlayerRegPath);
48 // registry paths can also be appended like file system path 120 // registry paths can also be appended like file system path
49 reg_path.push_back(FilePath::kSeparators[0]); 121 reg_path.push_back(FilePath::kSeparators[0]);
50 reg_path.append(installer::kChromeExe); 122 reg_path.append(installer::kChromeExe);
51 VLOG(1) << "Adding Chrome to Media player list at " << reg_path; 123 VLOG(1) << "Adding Chrome to Media player list at " << reg_path;
52 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( 124 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem(
53 HKEY_LOCAL_MACHINE, reg_path)); 125 HKEY_LOCAL_MACHINE, reg_path));
54 126
55 // if the operation fails we log the error but still continue 127 // if the operation fails we log the error but still continue
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 << " to " << src_path.value(); 322 << " to " << src_path.value();
251 return true; 323 return true;
252 } else { 324 } else {
253 PLOG(ERROR) << "Error writing " << installer::kVisualElementsManifest 325 PLOG(ERROR) << "Error writing " << installer::kVisualElementsManifest
254 << " to " << src_path.value(); 326 << " to " << src_path.value();
255 return false; 327 return false;
256 } 328 }
257 } 329 }
258 } 330 }
259 331
260 void CreateOrUpdateStartMenuAndTaskbarShortcuts( 332 void CreateOrUpdateShortcuts(const InstallerState& installer_state,
261 const InstallerState& installer_state, 333 const FilePath& setup_exe,
262 const FilePath& setup_exe, 334 const Product& product,
263 const Product& product, 335 InstallShortcutOperation install_operation,
264 uint32 options) { 336 bool alternate_desktop_shortcut) {
265 // TODO(tommi): Change this function to use WorkItemList. 337 // TODO(tommi): Change this function to use WorkItemList.
266 DCHECK(product.is_chrome()); 338 DCHECK(product.is_chrome());
267 339
268 // Information used for all shortcut types 340 BrowserDistribution* dist = product.distribution();
269 BrowserDistribution* browser_dist = product.distribution(); 341 const FilePath chrome_exe(
270 const string16 product_name(browser_dist->GetAppShortCutName());
271 const string16 product_desc(browser_dist->GetAppDescription());
272 // Chrome link target
273 FilePath chrome_exe(
274 installer_state.target_path().Append(installer::kChromeExe)); 342 installer_state.target_path().Append(installer::kChromeExe));
343 ShellUtil::ShellChange install_level =
344 installer_state.system_install() ? ShellUtil::SYSTEM_LEVEL :
345 ShellUtil::CURRENT_USER;
275 346
276 bool create_always = ((options & ShellUtil::SHORTCUT_CREATE_ALWAYS) != 0); 347 // The default operation on update is to overwrite shortcuts with the
277 const char* operation = create_always ? "Creating" : "Updating"; 348 // currently desired properties, but do so only for shortcuts that still
349 // exist.
350 ShellUtil::ChromeShortcutOperation shortcut_operation =
351 ShellUtil::SHORTCUT_REPLACE_EXISTING;
278 352
279 // Create Start Menu shortcuts. 353 // |base_properties|: The basic properties to set on every shortcut installed
280 // The location of Start->Programs->Google Chrome folder 354 // (to be refined on a per-shortcut basis).
281 FilePath start_menu_folder_path; 355 ShellUtil::ChromeShortcutProperties base_properties(install_level);
282 int dir_enum = installer_state.system_install() ? 356 base_properties.set_chrome_exe(chrome_exe);
283 base::DIR_COMMON_START_MENU : base::DIR_START_MENU; 357
284 if (!PathService::Get(dir_enum, &start_menu_folder_path)) { 358 // If |install_operation| is INSTALL_SHORTCUT_CREATE_ALL, create optional
285 LOG(ERROR) << "Failed to get start menu path."; 359 // shortcuts (Desktop and Quick Launch) immediately; otherwise delay their
286 return; 360 // creation until first run.
361 if (install_operation == INSTALL_SHORTCUT_CREATE_ALL)
362 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS;
363
364 ShellUtil::ChromeShortcutProperties desktop_properties(base_properties);
365 if (alternate_desktop_shortcut)
366 desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName());
367 ExecuteAndLogShortcutOperation(
368 ShellUtil::SHORTCUT_DESKTOP, dist, desktop_properties,
369 shortcut_operation);
370
371 ExecuteAndLogShortcutOperation(
372 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, base_properties,
373 shortcut_operation);
374 if (installer_state.system_install() &&
375 shortcut_operation == ShellUtil::SHORTCUT_CREATE_ALWAYS) {
376 // On system-level installs, also create the quick launch shortcut for this
377 // user (as the all-users shortcut created is in "Default User" and only
378 // affects new users).
379 ShellUtil::ChromeShortcutProperties user_ql_properties(base_properties);
380 user_ql_properties.level = ShellUtil::CURRENT_USER;
381 ExecuteAndLogShortcutOperation(
382 ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, user_ql_properties,
383 shortcut_operation);
287 } 384 }
288 385
289 start_menu_folder_path = start_menu_folder_path.Append(product_name); 386 // Turn on shortcut creation for mandatory shortcuts if requested.
387 if (install_operation == INSTALL_SHORTCUT_CREATE_MANDATORY)
388 shortcut_operation = ShellUtil::SHORTCUT_CREATE_ALWAYS;
290 389
291 // Create/update Chrome link (points to chrome.exe) & Uninstall Chrome link 390 ShellUtil::ChromeShortcutProperties start_menu_properties(base_properties);
292 // (which points to setup.exe) under |start_menu_folder_path|. 391 // IMPORTANT: Only the default (no arguments and default browserappid) browser
392 // shortcut in the Start menu (Start screen on Win8+) should be made dual
393 // mode.
394 start_menu_properties.set_dual_mode(true);
395 if (shortcut_operation == ShellUtil::SHORTCUT_CREATE_ALWAYS)
396 start_menu_properties.set_pin_to_taskbar(true);
397 ExecuteAndLogShortcutOperation(
398 ShellUtil::SHORTCUT_START_MENU, dist, start_menu_properties,
399 shortcut_operation);
293 400
294 // Chrome link (launches Chrome) 401 // Create/update uninstall link in the Start menu if we are not an MSI
295 FilePath chrome_link(start_menu_folder_path.Append(product_name + L".lnk")); 402 // install. MSI installations are, for the time being, managed only through
296 403 // the Add/Remove Programs dialog.
297 if (create_always && !file_util::PathExists(start_menu_folder_path))
298 file_util::CreateDirectoryW(start_menu_folder_path);
299
300 VLOG(1) << operation << " shortcut to " << chrome_exe.value() << " at "
301 << chrome_link.value();
302 if (!ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(),
303 chrome_link.value(), string16(), product_desc, chrome_exe.value(),
304 browser_dist->GetIconIndex(), options)) {
305 LOG(WARNING) << operation << " shortcut at " << chrome_link.value()
306 << " failed.";
307 } else if (create_always &&
308 base::win::GetVersion() >= base::win::VERSION_WIN7) {
309 // If the Start Menu shortcut was successfully created and |create_always|,
310 // proceed to pin the Start Menu shortcut to the taskbar on Win7+.
311 VLOG(1) << "Pinning new shortcut at " << chrome_link.value()
312 << " to taskbar";
313 if (!base::win::TaskbarPinShortcutLink(chrome_link.value().c_str())) {
314 LOG(ERROR) << "Failed to pin shortcut to taskbar: "
315 << chrome_link.value();
316 }
317 }
318
319 // Create/update uninstall link if we are not an MSI install. MSI
320 // installations are, for the time being, managed only through the
321 // Add/Remove Programs dialog.
322 // TODO(robertshield): We could add a shortcut to msiexec /X {GUID} here. 404 // TODO(robertshield): We could add a shortcut to msiexec /X {GUID} here.
323 if (!installer_state.is_msi()) { 405 if (!installer_state.is_msi()) {
324 // Uninstall Chrome link 406 FilePath shortcut_path;
325 FilePath uninstall_link(start_menu_folder_path.Append( 407 if (!ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_START_MENU, dist,
326 browser_dist->GetUninstallLinkName() + L".lnk")); 408 install_level, &shortcut_path)) {
327 409 NOTREACHED();
410 return;
411 }
412 shortcut_path = shortcut_path.Append(dist->GetUninstallLinkName() +
413 kLnkExt);
328 CommandLine arguments(CommandLine::NO_PROGRAM); 414 CommandLine arguments(CommandLine::NO_PROGRAM);
329 AppendUninstallCommandLineFlags(installer_state, product, &arguments); 415 AppendUninstallCommandLineFlags(installer_state, product, &arguments);
330 VLOG(1) << operation << " uninstall link at " << uninstall_link.value(); 416
331 base::win::ShortcutProperties shortcut_properties; 417 base::win::ShortcutProperties uninstall_properties;
332 shortcut_properties.set_target(setup_exe); 418 uninstall_properties.set_target(setup_exe);
333 shortcut_properties.set_arguments(arguments.GetCommandLineString()); 419 uninstall_properties.set_arguments(arguments.GetCommandLineString());
334 shortcut_properties.set_icon(setup_exe, 0); 420 base::win::ShortcutOperation uninstall_operation =
421 (shortcut_operation == ShellUtil::SHORTCUT_CREATE_ALWAYS ?
422 base::win::SHORTCUT_CREATE_ALWAYS :
423 base::win::SHORTCUT_REPLACE_EXISTING);
424 const char* operation_str =
425 (uninstall_operation == base::win::SHORTCUT_CREATE_ALWAYS ?
426 "Creating" : "Updating");
427 VLOG(1) << operation_str << " uninstall link at " << shortcut_path.value();
335 if (!base::win::CreateOrUpdateShortcutLink( 428 if (!base::win::CreateOrUpdateShortcutLink(
336 uninstall_link, shortcut_properties, 429 shortcut_path, uninstall_properties, uninstall_operation)) {
337 create_always ? base::win::SHORTCUT_CREATE_ALWAYS : 430 LOG(WARNING) << operation_str << " uninstall link failed.";
338 base::win::SHORTCUT_UPDATE_EXISTING)) {
339 LOG(WARNING) << operation << " uninstall link at "
340 << uninstall_link.value() << " failed.";
341 } 431 }
342 } 432 }
343 } 433 }
344 434
345 void CreateOrUpdateDesktopAndQuickLaunchShortcuts(
346 const InstallerState& installer_state,
347 const Product& product,
348 uint32 options) {
349 // TODO(tommi): Change this function to use WorkItemList.
350 DCHECK(product.is_chrome());
351
352 // Information used for all shortcut types
353 BrowserDistribution* browser_dist = product.distribution();
354 const string16 product_name(browser_dist->GetAppShortCutName());
355 const string16 product_desc(browser_dist->GetAppDescription());
356 // Chrome link target
357 FilePath chrome_exe(
358 installer_state.target_path().Append(installer::kChromeExe));
359
360 bool create_always = ((options & ShellUtil::SHORTCUT_CREATE_ALWAYS) != 0);
361 const char* operation = create_always ? "Creating" : "Updating";
362
363 ShellUtil::ShellChange desktop_level = ShellUtil::CURRENT_USER;
364 int quick_launch_levels = ShellUtil::CURRENT_USER;
365 if (installer_state.system_install()) {
366 desktop_level = ShellUtil::SYSTEM_LEVEL;
367 quick_launch_levels |= ShellUtil::SYSTEM_LEVEL;
368 }
369
370 VLOG(1) << operation << " desktop shortcut for " << chrome_exe.value();
371 if (!ShellUtil::CreateChromeDesktopShortcut(
372 browser_dist, chrome_exe.value(), product_desc, string16(),
373 string16(), chrome_exe.value(), browser_dist->GetIconIndex(),
374 desktop_level, options)) {
375 LOG(WARNING) << operation << " desktop shortcut for " << chrome_exe.value()
376 << " failed.";
377 }
378
379 VLOG(1) << operation << " quick launch shortcut for " << chrome_exe.value();
380 if (!ShellUtil::CreateChromeQuickLaunchShortcut(
381 browser_dist, chrome_exe.value(), quick_launch_levels, options)) {
382 LOG(WARNING) << operation << " quick launch shortcut for "
383 << chrome_exe.value() << " failed.";
384 }
385 }
386
387 void RegisterChromeOnMachine(const InstallerState& installer_state, 435 void RegisterChromeOnMachine(const InstallerState& installer_state,
388 const Product& product, 436 const Product& product,
389 bool make_chrome_default) { 437 bool make_chrome_default) {
390 DCHECK(product.is_chrome()); 438 DCHECK(product.is_chrome());
391 439
392 // Try to add Chrome to Media Player shim inclusion list. We don't do any 440 // Try to add Chrome to Media Player shim inclusion list. We don't do any
393 // error checking here because this operation will fail if user doesn't 441 // error checking here because this operation will fail if user doesn't
394 // have admin rights and we want to ignore the error. 442 // have admin rights and we want to ignore the error.
395 AddChromeToMediaPlayerList(); 443 AddChromeToMediaPlayerList();
396 444
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 const Product* chrome_install = 520 const Product* chrome_install =
473 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER); 521 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER);
474 if (chrome_install) { 522 if (chrome_install) {
475 installer_state.UpdateStage(installer::CREATING_SHORTCUTS); 523 installer_state.UpdateStage(installer::CREATING_SHORTCUTS);
476 524
477 bool create_all_shortcuts = false; 525 bool create_all_shortcuts = false;
478 prefs.GetBool(master_preferences::kCreateAllShortcuts, 526 prefs.GetBool(master_preferences::kCreateAllShortcuts,
479 &create_all_shortcuts); 527 &create_all_shortcuts);
480 bool alt_shortcut = false; 528 bool alt_shortcut = false;
481 prefs.GetBool(master_preferences::kAltShortcutText, &alt_shortcut); 529 prefs.GetBool(master_preferences::kAltShortcutText, &alt_shortcut);
482 // The DUAL_MODE property is technically only needed on the Start Screen
483 // shortcut on Win8, but we set it on all shortcuts so that pinning any
484 // of the shortcuts to the Start Screen results in a shortcut with
485 // Metro properties.
486 uint32 shortcut_options = ShellUtil::SHORTCUT_DUAL_MODE;
487 // Handle Desktop and Quick Launch shortcuts creation.
488 // If --create-all-shortcuts is specified, create them immediately;
489 // otherwise delay their creation until first run (if they already exist,
490 // (i.e. on update) update them).
491 if (create_all_shortcuts)
492 shortcut_options |= ShellUtil::SHORTCUT_CREATE_ALWAYS;
493 // Use the alternate name for the Desktop shortcut if indicated.
494 if (alt_shortcut)
495 shortcut_options |= ShellUtil::SHORTCUT_ALTERNATE;
496 CreateOrUpdateDesktopAndQuickLaunchShortcuts(
497 installer_state, *chrome_install, shortcut_options);
498 530
499 if (result == installer::FIRST_INSTALL_SUCCESS || 531 InstallShortcutOperation install_operation =
500 result == installer::INSTALL_REPAIRED) { 532 INSTALL_SHORTCUT_REPLACE_EXISTING;
501 // On new installs and repaired installs, always create Start Menu 533 if (create_all_shortcuts) {
502 // and taskbar shortcuts (i.e. even if they were previously deleted by 534 install_operation = INSTALL_SHORTCUT_CREATE_ALL;
503 // the user). 535 } else if (result == installer::FIRST_INSTALL_SUCCESS ||
504 shortcut_options |= ShellUtil::SHORTCUT_CREATE_ALWAYS; 536 result == installer::INSTALL_REPAIRED) {
537 // On new and repaired installs, always create Start Menu, taskbar, and
538 // uninstall shortcuts (i.e. even if they were previously deleted by the
539 // user).
540 install_operation = INSTALL_SHORTCUT_CREATE_MANDATORY;
505 } 541 }
542
506 FilePath setup_exe(installer_state.GetInstallerDirectory(new_version) 543 FilePath setup_exe(installer_state.GetInstallerDirectory(new_version)
507 .Append(setup_path.BaseName())); 544 .Append(setup_path.BaseName()));
508 CreateOrUpdateStartMenuAndTaskbarShortcuts( 545 CreateOrUpdateShortcuts(installer_state, setup_exe, *chrome_install,
509 installer_state, setup_exe, *chrome_install, shortcut_options); 546 install_operation, alt_shortcut);
510 547
511 bool make_chrome_default = false; 548 bool make_chrome_default = false;
512 prefs.GetBool(master_preferences::kMakeChromeDefault, 549 prefs.GetBool(master_preferences::kMakeChromeDefault,
513 &make_chrome_default); 550 &make_chrome_default);
514 551
515 // If this is not the user's first Chrome install, but they have chosen 552 // If this is not the user's first Chrome install, but they have chosen
516 // Chrome to become their default browser on the download page, we must 553 // Chrome to become their default browser on the download page, we must
517 // force it here because the master_preferences file will not get copied 554 // force it here because the master_preferences file will not get copied
518 // into the build. 555 // into the build.
519 bool force_chrome_default_for_user = false; 556 bool force_chrome_default_for_user = false;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 593 }
557 594
558 void HandleOsUpgradeForBrowser(const InstallerState& installer_state, 595 void HandleOsUpgradeForBrowser(const InstallerState& installer_state,
559 const Product& chrome, 596 const Product& chrome,
560 const FilePath& setup_exe) { 597 const FilePath& setup_exe) {
561 DCHECK(chrome.is_chrome()); 598 DCHECK(chrome.is_chrome());
562 // Upon upgrading to Windows 8, we need to fix Chrome shortcuts and register 599 // Upon upgrading to Windows 8, we need to fix Chrome shortcuts and register
563 // Chrome, so that Metro Chrome would work if Chrome is the default browser. 600 // Chrome, so that Metro Chrome would work if Chrome is the default browser.
564 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 601 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
565 VLOG(1) << "Updating and registering shortcuts."; 602 VLOG(1) << "Updating and registering shortcuts.";
566 uint32 shortcut_options = ShellUtil::SHORTCUT_DUAL_MODE; 603 CreateOrUpdateShortcuts(
567 CreateOrUpdateDesktopAndQuickLaunchShortcuts( 604 installer_state, setup_exe, chrome, INSTALL_SHORTCUT_REPLACE_EXISTING,
568 installer_state, chrome, shortcut_options); 605 false);
569 CreateOrUpdateStartMenuAndTaskbarShortcuts(
570 installer_state, setup_exe, chrome, shortcut_options);
571 RegisterChromeOnMachine(installer_state, chrome, false); 606 RegisterChromeOnMachine(installer_state, chrome, false);
572 } 607 }
573 } 608 }
574 609
575 } // namespace installer 610 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.h ('k') | chrome/installer/setup/install_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698