OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 installer_state.target_path().Append(installer::kChromeExe)); | 124 installer_state.target_path().Append(installer::kChromeExe)); |
125 | 125 |
126 if ((install_status == installer::FIRST_INSTALL_SUCCESS) || | 126 if ((install_status == installer::FIRST_INSTALL_SUCCESS) || |
127 (install_status == installer::INSTALL_REPAIRED)) { | 127 (install_status == installer::INSTALL_REPAIRED)) { |
128 if (!file_util::PathExists(shortcut_path)) | 128 if (!file_util::PathExists(shortcut_path)) |
129 file_util::CreateDirectoryW(shortcut_path); | 129 file_util::CreateDirectoryW(shortcut_path); |
130 | 130 |
131 VLOG(1) << "Creating shortcut to " << chrome_exe.value() << " at " | 131 VLOG(1) << "Creating shortcut to " << chrome_exe.value() << " at " |
132 << chrome_link.value(); | 132 << chrome_link.value(); |
133 ret = ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(), | 133 ret = ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(), |
134 chrome_link.value(), L"", product_desc, true); | 134 chrome_link.value(), L"", product_desc, chrome_exe.value(), |
| 135 browser_dist->GetIconIndex(), true); |
135 } else if (file_util::PathExists(chrome_link)) { | 136 } else if (file_util::PathExists(chrome_link)) { |
136 VLOG(1) << "Updating shortcut at " << chrome_link.value() | 137 VLOG(1) << "Updating shortcut at " << chrome_link.value() |
137 << " to point to " << chrome_exe.value(); | 138 << " to point to " << chrome_exe.value(); |
138 ret = ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(), | 139 ret = ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(), |
139 chrome_link.value(), L"", product_desc, false); | 140 chrome_link.value(), L"", product_desc, chrome_exe.value(), |
| 141 browser_dist->GetIconIndex(), false); |
140 } else { | 142 } else { |
141 VLOG(1) | 143 VLOG(1) |
142 << "not first or repaired install, link file doesn't exist. status: " | 144 << "not first or repaired install, link file doesn't exist. status: " |
143 << install_status; | 145 << install_status; |
144 } | 146 } |
145 | 147 |
146 // Create/update uninstall link if we are not an MSI install. MSI | 148 // Create/update uninstall link if we are not an MSI install. MSI |
147 // installations are, for the time being, managed only through the | 149 // installations are, for the time being, managed only through the |
148 // Add/Remove Programs dialog. | 150 // Add/Remove Programs dialog. |
149 // TODO(robertshield): We could add a shortcut to msiexec /X {GUID} here. | 151 // TODO(robertshield): We could add a shortcut to msiexec /X {GUID} here. |
(...skipping 22 matching lines...) Expand all Loading... |
172 setup_exe.value().c_str(), | 174 setup_exe.value().c_str(), |
173 0, | 175 0, |
174 NULL); | 176 NULL); |
175 } | 177 } |
176 } | 178 } |
177 | 179 |
178 // Update Desktop and Quick Launch shortcuts. If --create-new-shortcuts | 180 // Update Desktop and Quick Launch shortcuts. If --create-new-shortcuts |
179 // is specified we want to create them, otherwise we update them only if | 181 // is specified we want to create them, otherwise we update them only if |
180 // they exist. | 182 // they exist. |
181 if (ret) { | 183 if (ret) { |
| 184 ShellUtil::ShellChange desktop_level = ShellUtil::CURRENT_USER; |
| 185 int quick_launch_levels = ShellUtil::CURRENT_USER; |
182 if (installer_state.system_install()) { | 186 if (installer_state.system_install()) { |
183 ret = ShellUtil::CreateChromeDesktopShortcut(product.distribution(), | 187 desktop_level = ShellUtil::SYSTEM_LEVEL; |
184 chrome_exe.value(), product_desc, L"", L"", ShellUtil::SYSTEM_LEVEL, | 188 quick_launch_levels |= ShellUtil::SYSTEM_LEVEL; |
185 alt_shortcut, create_all_shortcut); | 189 } |
186 if (ret) { | 190 ret = ShellUtil::CreateChromeDesktopShortcut(browser_dist, |
187 ret = ShellUtil::CreateChromeQuickLaunchShortcut( | 191 chrome_exe.value(), product_desc, L"", L"", chrome_exe.value(), |
188 product.distribution(), chrome_exe.value(), | 192 browser_dist->GetIconIndex(), desktop_level, alt_shortcut, |
189 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, | 193 create_all_shortcut); |
190 create_all_shortcut); | 194 if (ret) { |
191 } | 195 ret = ShellUtil::CreateChromeQuickLaunchShortcut( |
192 } else { | 196 browser_dist, chrome_exe.value(), quick_launch_levels, |
193 ret = ShellUtil::CreateChromeDesktopShortcut(product.distribution(), | 197 create_all_shortcut); |
194 chrome_exe.value(), product_desc, L"", L"", ShellUtil::CURRENT_USER, | |
195 alt_shortcut, create_all_shortcut); | |
196 if (ret) { | |
197 ret = ShellUtil::CreateChromeQuickLaunchShortcut( | |
198 product.distribution(), chrome_exe.value(), ShellUtil::CURRENT_USER, | |
199 create_all_shortcut); | |
200 } | |
201 } | 198 } |
202 } | 199 } |
203 | 200 |
204 return ret; | 201 return ret; |
205 } | 202 } |
206 | 203 |
207 void RegisterChromeOnMachine(const InstallerState& installer_state, | 204 void RegisterChromeOnMachine(const InstallerState& installer_state, |
208 const Product& product, | 205 const Product& product, |
209 bool make_chrome_default) { | 206 bool make_chrome_default) { |
210 DCHECK(product.is_chrome()); | 207 DCHECK(product.is_chrome()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 installer_state.RemoveOldVersionDirectories( | 418 installer_state.RemoveOldVersionDirectories( |
422 new_version, | 419 new_version, |
423 existing_version.get(), | 420 existing_version.get(), |
424 install_temp_path); | 421 install_temp_path); |
425 } | 422 } |
426 | 423 |
427 return result; | 424 return result; |
428 } | 425 } |
429 | 426 |
430 } // namespace installer | 427 } // namespace installer |
OLD | NEW |