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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 message.append("(maybe the shortcut doesn't exist?) "); | 63 message.append("(maybe the shortcut doesn't exist?) "); |
64 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : | 64 message.append((properties.level == ShellUtil::CURRENT_USER) ? "per-user " : |
65 "all-users "); | 65 "all-users "); |
66 switch (location) { | 66 switch (location) { |
67 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: | 67 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: |
68 message.append("Desktop "); | 68 message.append("Desktop "); |
69 break; | 69 break; |
70 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: | 70 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: |
71 message.append("Quick Launch "); | 71 message.append("Quick Launch "); |
72 break; | 72 break; |
73 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR: | 73 case ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT: |
74 message.append("Start menu "); | |
75 break; | |
76 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED: | |
74 message.append("Start menu/" + | 77 message.append("Start menu/" + |
75 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 78 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
76 BrowserDistribution::SUBFOLDER_CHROME)) + | 79 BrowserDistribution::SUBFOLDER_CHROME)) + |
77 " "); | 80 " "); |
78 break; | 81 break; |
79 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: | 82 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
80 message.append("Start menu/" + | 83 message.append("Start menu/" + |
81 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( | 84 base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder( |
82 BrowserDistribution::SUBFOLDER_APPS)) + | 85 BrowserDistribution::SUBFOLDER_APPS)) + |
83 " "); | 86 " "); |
(...skipping 25 matching lines...) Expand all Loading... | |
109 } | 112 } |
110 | 113 |
111 message.push_back('.'); | 114 message.push_back('.'); |
112 | 115 |
113 if (failed) | 116 if (failed) |
114 LOG(WARNING) << message; | 117 LOG(WARNING) << message; |
115 else | 118 else |
116 VLOG(1) << message; | 119 VLOG(1) << message; |
117 } | 120 } |
118 | 121 |
119 void ExecuteAndLogShortcutOperation( | 122 bool ExecuteAndLogShortcutOperation( |
grt (UTC plus 2)
2015/10/19 17:28:44
this return value is unused. why introduce it?
grt (UTC plus 2)
2015/10/20 18:10:30
ping
bcwhite
2015/10/20 18:25:43
I left it in in because it's not really extra code
| |
120 ShellUtil::ShortcutLocation location, | 123 ShellUtil::ShortcutLocation location, |
121 BrowserDistribution* dist, | 124 BrowserDistribution* dist, |
122 const ShellUtil::ShortcutProperties& properties, | 125 const ShellUtil::ShortcutProperties& properties, |
123 ShellUtil::ShortcutOperation operation) { | 126 ShellUtil::ShortcutOperation operation) { |
124 LogShortcutOperation(location, dist, properties, operation, false); | 127 LogShortcutOperation(location, dist, properties, operation, false); |
125 if (!ShellUtil::CreateOrUpdateShortcut(location, dist, properties, | 128 if (!ShellUtil::CreateOrUpdateShortcut(location, dist, properties, |
126 operation)) { | 129 operation)) { |
127 LogShortcutOperation(location, dist, properties, operation, true); | 130 LogShortcutOperation(location, dist, properties, operation, true); |
131 return false; | |
128 } | 132 } |
133 return true; | |
129 } | 134 } |
130 | 135 |
131 void AddChromeToMediaPlayerList() { | 136 void AddChromeToMediaPlayerList() { |
132 base::string16 reg_path(installer::kMediaPlayerRegPath); | 137 base::string16 reg_path(installer::kMediaPlayerRegPath); |
133 // registry paths can also be appended like file system path | 138 // registry paths can also be appended like file system path |
134 reg_path.push_back(base::FilePath::kSeparators[0]); | 139 reg_path.push_back(base::FilePath::kSeparators[0]); |
135 reg_path.append(installer::kChromeExe); | 140 reg_path.append(installer::kChromeExe); |
136 VLOG(1) << "Adding Chrome to Media player list at " << reg_path; | 141 VLOG(1) << "Adding Chrome to Media player list at " << reg_path; |
137 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( | 142 scoped_ptr<WorkItem> work_item(WorkItem::CreateCreateRegKeyWorkItem( |
138 HKEY_LOCAL_MACHINE, reg_path, WorkItem::kWow64Default)); | 143 HKEY_LOCAL_MACHINE, reg_path, WorkItem::kWow64Default)); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 if (InstallUtil::ShouldInstallMetroProperties()) | 432 if (InstallUtil::ShouldInstallMetroProperties()) |
428 start_menu_properties.set_dual_mode(true); | 433 start_menu_properties.set_dual_mode(true); |
429 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || | 434 if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || |
430 shortcut_operation == | 435 shortcut_operation == |
431 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { | 436 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { |
432 start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut); | 437 start_menu_properties.set_pin_to_taskbar(!do_not_create_taskbar_shortcut); |
433 // Disabled for now. TODO(gab): Remove this and the associated code if it | 438 // Disabled for now. TODO(gab): Remove this and the associated code if it |
434 // remains disabled long term. | 439 // remains disabled long term. |
435 start_menu_properties.set_pin_to_start(false); | 440 start_menu_properties.set_pin_to_start(false); |
436 } | 441 } |
442 | |
443 // Move start-menu shortcuts out of the deprecated Chrome specific subfolder. | |
grt (UTC plus 2)
2015/10/19 17:28:45
is plural correct here? is there ever more than on
bcwhite
2015/10/20 16:02:13
Done.
| |
444 // This needs to happen before the shortcut update below or it will fail due | |
grt (UTC plus 2)
2015/10/19 17:28:45
nit: "or it will" -> "or the latter will"
bcwhite
2015/10/20 16:02:13
Done.
| |
445 // to the existing shortcut not being in the location as the new one. | |
grt (UTC plus 2)
2015/10/19 17:28:44
suggestion: "the existing shortcut not being in th
bcwhite
2015/10/20 16:02:13
That would be incorrect. It fails below not becau
grt (UTC plus 2)
2015/10/20 18:10:30
I still find this wording awkward. The call to Exe
bcwhite
2015/10/20 18:25:43
I see. I think of it as two different shortcuts,
| |
446 base::FilePath old_shortcut_path; | |
447 ShellUtil::GetShortcutPath( | |
448 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, dist, | |
449 shortcut_level, &old_shortcut_path); | |
450 if (base::PathExists(old_shortcut_path)) { | |
451 ShellUtil::MoveExistingShortcut( | |
452 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, | |
453 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, | |
454 dist, shortcut_level, start_menu_properties); | |
455 } | |
456 | |
437 ExecuteAndLogShortcutOperation( | 457 ExecuteAndLogShortcutOperation( |
438 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist, | 458 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist, |
439 start_menu_properties, shortcut_operation); | 459 start_menu_properties, shortcut_operation); |
440 } | 460 } |
441 | 461 |
442 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, | 462 void RegisterChromeOnMachine(const installer::InstallerState& installer_state, |
443 const installer::Product& product, | 463 const installer::Product& product, |
444 bool make_chrome_default) { | 464 bool make_chrome_default) { |
445 DCHECK(product.is_chrome()); | 465 DCHECK(product.is_chrome()); |
446 | 466 |
447 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 467 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
448 // error checking here because this operation will fail if user doesn't | 468 // error checking here because this operation will fail if user doesn't |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 // Read master_preferences copied beside chrome.exe at install. | 703 // Read master_preferences copied beside chrome.exe at install. |
684 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); | 704 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); |
685 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); | 705 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); |
686 CreateOrUpdateShortcuts( | 706 CreateOrUpdateShortcuts( |
687 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); | 707 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); |
688 | 708 |
689 UpdateDefaultBrowserBeaconForPath(chrome_exe); | 709 UpdateDefaultBrowserBeaconForPath(chrome_exe); |
690 } | 710 } |
691 | 711 |
692 } // namespace installer | 712 } // namespace installer |
OLD | NEW |