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/browser/profiles/profile_shortcut_manager.h" | 5 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 description = WideToUTF16(dist->GetAppDescription()); | 191 description = WideToUTF16(dist->GetAppDescription()); |
192 | 192 |
193 // Add the profile to the map if it doesn't exist already | 193 // Add the profile to the map if it doesn't exist already |
194 if (!profile_shortcuts_.count(profile_path)) { | 194 if (!profile_shortcuts_.count(profile_path)) { |
195 string16 flags = CreateProfileShortcutFlags(profile_path); | 195 string16 flags = CreateProfileShortcutFlags(profile_path); |
196 profile_shortcuts_.insert(std::make_pair(profile_path, | 196 profile_shortcuts_.insert(std::make_pair(profile_path, |
197 ProfileShortcutInfo(flags, profile_name, | 197 ProfileShortcutInfo(flags, profile_name, |
198 avatar_image))); | 198 avatar_image))); |
199 } | 199 } |
200 | 200 |
201 ShellUtil::CreateChromeDesktopShortcut( | 201 ShellUtil::CreateOrUpdateChromeShortcut( |
| 202 ShellUtil::SHORTCUT_DESKTOP, |
202 dist, | 203 dist, |
203 chrome_exe.value(), | 204 chrome_exe.value(), |
204 description, | 205 description, |
205 profile_shortcuts_[profile_path].profile_name, | 206 profile_shortcuts_[profile_path].profile_name, |
206 profile_shortcuts_[profile_path].flags, | 207 profile_shortcuts_[profile_path].flags, |
207 shortcut_icon.empty() ? chrome_exe.value() : shortcut_icon.value(), | 208 shortcut_icon.empty() ? chrome_exe.value() : shortcut_icon.value(), |
208 shortcut_icon.empty() ? dist->GetIconIndex() : 0, | 209 shortcut_icon.empty() ? dist->GetIconIndex() : 0, |
209 ShellUtil::CURRENT_USER, | |
210 ShellUtil::SHORTCUT_CREATE_ALWAYS); | 210 ShellUtil::SHORTCUT_CREATE_ALWAYS); |
211 } | 211 } |
212 | 212 |
213 void ProfileShortcutManagerWin::DeleteChromeDesktopShortcut( | 213 void ProfileShortcutManagerWin::DeleteChromeDesktopShortcut( |
214 const FilePath& profile_path) { | 214 const FilePath& profile_path) { |
215 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 215 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
216 string16 shortcut; | 216 string16 shortcut; |
217 // If we can find the shortcut, delete it | 217 // If we can find the shortcut, delete it |
218 if (ShellUtil::GetChromeShortcutName(dist, false, | 218 if (ShellUtil::GetChromeShortcutName( |
219 profile_shortcuts_[profile_path].profile_name, &shortcut)) { | 219 ShellUtil::SHORTCUT_DESKTOP, dist, false, |
| 220 profile_shortcuts_[profile_path].profile_name, &shortcut)) { |
220 std::vector<string16> appended_names(1, shortcut); | 221 std::vector<string16> appended_names(1, shortcut); |
221 BrowserThread::PostTask( | 222 BrowserThread::PostTask( |
222 BrowserThread::FILE, FROM_HERE, | 223 BrowserThread::FILE, FROM_HERE, |
223 base::Bind(&CallShellUtilBoolFunction, base::Bind( | 224 base::Bind(&CallShellUtilBoolFunction, base::Bind( |
224 &ShellUtil::RemoveChromeDesktopShortcutsWithAppendedNames, | 225 &ShellUtil::RemoveChromeDesktopShortcutsWithAppendedNames, |
225 appended_names))); | 226 appended_names))); |
226 profile_shortcuts_.erase(profile_path); | 227 profile_shortcuts_.erase(profile_path); |
227 } | 228 } |
228 } | 229 } |
229 | |
OLD | NEW |