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

Side by Side Diff: chrome/browser/profiles/profile_shortcut_manager_win.cc

Issue 11299160: Find shortcuts that don't have a profile command line set when creating 2nd profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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/browser/profiles/profile_shortcut_manager_win.h" 5 #include "chrome/browser/profiles/profile_shortcut_manager_win.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 offscreen_canvas->getDevice()->accessBitmap(false); 91 offscreen_canvas->getDevice()->accessBitmap(false);
92 92
93 // Finally, write the .ico file containing this new bitmap. 93 // Finally, write the .ico file containing this new bitmap.
94 FilePath icon_path = profile_path.AppendASCII(kProfileIconFileName); 94 FilePath icon_path = profile_path.AppendASCII(kProfileIconFileName);
95 if (!IconUtil::CreateIconFileFromSkBitmap(final_bitmap, icon_path)) 95 if (!IconUtil::CreateIconFileFromSkBitmap(final_bitmap, icon_path))
96 return FilePath(); 96 return FilePath();
97 97
98 return icon_path; 98 return icon_path;
99 } 99 }
100 100
101 // Returns the command-line flags to launch Chrome with the given profile.
102 string16 CreateProfileShortcutFlags(const FilePath& profile_path) {
103 return base::StringPrintf(L"--%ls=\"%ls\"",
104 ASCIIToUTF16(switches::kProfileDirectory).c_str(),
105 profile_path.BaseName().value().c_str());
106 }
107
108 // Gets the directory where to create desktop shortcuts. 101 // Gets the directory where to create desktop shortcuts.
109 bool GetDesktopShortcutsDirectory(FilePath* directory) { 102 bool GetDesktopShortcutsDirectory(FilePath* directory) {
110 const bool result = 103 const bool result =
111 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, 104 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
112 BrowserDistribution::GetDistribution(), 105 BrowserDistribution::GetDistribution(),
113 ShellUtil::CURRENT_USER, directory); 106 ShellUtil::CURRENT_USER, directory);
114 DCHECK(result); 107 DCHECK(result);
115 return result; 108 return result;
116 } 109 }
117 110
118 // Returns true if the file at |path| is a Chrome shortcut with the given 111 // Returns true if the file at |path| is a Chrome shortcut and returns its
119 // |command_line|. 112 // command line in output parameter |command_line|.
120 bool IsChromeShortcutWithCommandLine(const FilePath& path, 113 bool IsChromeShortcut(const FilePath& path,
121 const FilePath& chrome_exe, 114 const FilePath& chrome_exe,
122 const string16& command_line) { 115 string16* command_line) {
123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
124 117
125 if (path.Extension() != installer::kLnkExt) 118 if (path.Extension() != installer::kLnkExt)
126 return false; 119 return false;
127 120
128 FilePath target_path; 121 FilePath target_path;
129 string16 command_line_args; 122 if (!base::win::ResolveShortcut(path, &target_path, command_line))
130 if (!base::win::ResolveShortcut(path, &target_path, &command_line_args))
131 return false; 123 return false;
132 124 return target_path == chrome_exe;
133 // TODO(asvitkine): Change this to build a CommandLine object and ensure all
134 // args from |command_line| are present in the shortcut's CommandLine. This
135 // will be more robust when |command_line| contains multiple args.
136 return target_path == chrome_exe &&
137 command_line_args.find(command_line) != string16::npos;
138 } 125 }
139 126
140 // Populates |paths| with the file paths of Chrome desktop shortcuts that have 127 // Populates |paths| with the file paths of Chrome desktop shortcuts that have
141 // the specified |command_line|. 128 // the specified |command_line|.
142 void ListDesktopShortcutsWithCommandLine(const FilePath& chrome_exe, 129 void ListDesktopShortcutsWithCommandLine(const FilePath& chrome_exe,
143 const string16& command_line, 130 const string16& command_line,
131 bool include_empty_command_lines,
144 std::vector<FilePath>* paths) { 132 std::vector<FilePath>* paths) {
145 FilePath shortcuts_directory; 133 FilePath shortcuts_directory;
146 if (!GetDesktopShortcutsDirectory(&shortcuts_directory)) 134 if (!GetDesktopShortcutsDirectory(&shortcuts_directory))
147 return; 135 return;
148 136
149 file_util::FileEnumerator enumerator(shortcuts_directory, false, 137 file_util::FileEnumerator enumerator(shortcuts_directory, false,
150 file_util::FileEnumerator::FILES); 138 file_util::FileEnumerator::FILES);
151 for (FilePath path = enumerator.Next(); !path.empty(); 139 for (FilePath path = enumerator.Next(); !path.empty();
152 path = enumerator.Next()) { 140 path = enumerator.Next()) {
153 if (IsChromeShortcutWithCommandLine(path, chrome_exe, command_line)) 141 string16 shortcut_command_line;
142 if (!IsChromeShortcut(path, chrome_exe, &shortcut_command_line))
143 continue;
144
145 // TODO(asvitkine): Change this to build a CommandLine object and ensure all
146 // args from |command_line| are present in the shortcut's CommandLine. This
147 // will be more robust when |command_line| contains multiple args.
148 if ((shortcut_command_line.empty() && include_empty_command_lines) ||
149 (shortcut_command_line.find(command_line) != string16::npos)) {
154 paths->push_back(path); 150 paths->push_back(path);
151 }
155 } 152 }
156 } 153 }
157 154
158 // Renames an existing Chrome desktop profile shortcut. Must be called on the 155 // Renames an existing Chrome desktop profile shortcut. Must be called on the
159 // FILE thread. 156 // FILE thread.
160 void RenameChromeDesktopShortcutForProfile( 157 void RenameChromeDesktopShortcutForProfile(
161 const string16& old_shortcut_file, 158 const string16& old_shortcut_file,
162 const string16& new_shortcut_file) { 159 const string16& new_shortcut_file) {
163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
164 161
(...skipping 11 matching lines...) Expand all
176 if (!file_util::Move(old_shortcut_path, new_shortcut_path)) 173 if (!file_util::Move(old_shortcut_path, new_shortcut_path))
177 LOG(ERROR) << "Could not rename Windows profile desktop shortcut."; 174 LOG(ERROR) << "Could not rename Windows profile desktop shortcut.";
178 } 175 }
179 176
180 // Updates all desktop shortcuts for the given profile to have the specified 177 // Updates all desktop shortcuts for the given profile to have the specified
181 // parameters. If |create| is true, a new desktop shortcut is created if no 178 // parameters. If |create| is true, a new desktop shortcut is created if no
182 // existing ones were found. Must be called on the FILE thread. 179 // existing ones were found. Must be called on the FILE thread.
183 void CreateOrUpdateDesktopShortcutsForProfile(const FilePath& profile_path, 180 void CreateOrUpdateDesktopShortcutsForProfile(const FilePath& profile_path,
184 const string16& profile_name, 181 const string16& profile_name,
185 const SkBitmap& avatar_image, 182 const SkBitmap& avatar_image,
183 bool include_empty_command_lines,
186 bool create) { 184 bool create) {
187 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
188 186
189 FilePath chrome_exe; 187 FilePath chrome_exe;
190 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { 188 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
191 NOTREACHED(); 189 NOTREACHED();
192 return; 190 return;
193 } 191 }
194 192
195 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); 193 BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
196 installer::Product product(distribution); 194 installer::Product product(distribution);
197 195
198 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); 196 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
199 product.AddDefaultShortcutProperties(chrome_exe, &properties); 197 product.AddDefaultShortcutProperties(chrome_exe, &properties);
200 const FilePath shortcut_icon = 198 const FilePath shortcut_icon =
201 CreateChromeDesktopShortcutIconForProfile(profile_path, avatar_image); 199 CreateChromeDesktopShortcutIconForProfile(profile_path, avatar_image);
202 if (!shortcut_icon.empty()) 200 if (!shortcut_icon.empty())
203 properties.set_icon(shortcut_icon, 0); 201 properties.set_icon(shortcut_icon, 0);
204 202
205 const string16 command_line = CreateProfileShortcutFlags(profile_path); 203 const string16 command_line =
204 profiles::internal::CreateProfileShortcutFlags(profile_path);
206 properties.set_arguments(command_line); 205 properties.set_arguments(command_line);
207 206
208 ShellUtil::ShortcutOperation operation = 207 ShellUtil::ShortcutOperation operation =
209 ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING; 208 ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING;
210 209
211 std::vector<FilePath> shortcuts; 210 std::vector<FilePath> shortcuts;
212 ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, &shortcuts); 211 ListDesktopShortcutsWithCommandLine(chrome_exe, command_line,
212 include_empty_command_lines, &shortcuts);
213 if (create && shortcuts.empty()) { 213 if (create && shortcuts.empty()) {
214 const string16 shortcut_name = 214 const string16 shortcut_name =
215 profiles::internal::GetShortcutFilenameForProfile(profile_name, 215 profiles::internal::GetShortcutFilenameForProfile(profile_name,
216 distribution); 216 distribution);
217 shortcuts.push_back(FilePath(shortcut_name)); 217 shortcuts.push_back(FilePath(shortcut_name));
218 operation = ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS; 218 operation = ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS;
219 } 219 }
220 220
221 for (size_t i = 0; i < shortcuts.size(); ++i) { 221 for (size_t i = 0; i < shortcuts.size(); ++i) {
222 const FilePath shortcut_name = shortcuts[i].BaseName().RemoveExtension(); 222 const FilePath shortcut_name = shortcuts[i].BaseName().RemoveExtension();
223 properties.set_shortcut_name(shortcut_name.value()); 223 properties.set_shortcut_name(shortcut_name.value());
224 ShellUtil::CreateOrUpdateShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, 224 ShellUtil::CreateOrUpdateShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
225 distribution, properties, operation); 225 distribution, properties, operation);
226 } 226 }
227 } 227 }
228 228
229 // Deletes all desktop shortcuts for the specified profile and also removes the 229 // Deletes all desktop shortcuts for the specified profile and also removes the
230 // corresponding icon file. Must be called on the FILE thread. 230 // corresponding icon file. Must be called on the FILE thread.
231 void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path, 231 void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path,
232 const FilePath& icon_path) { 232 const FilePath& icon_path) {
233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
234 234
235 FilePath chrome_exe; 235 FilePath chrome_exe;
236 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { 236 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
237 NOTREACHED(); 237 NOTREACHED();
238 return; 238 return;
239 } 239 }
240 240
241 const string16 command_line = CreateProfileShortcutFlags(profile_path); 241 const string16 command_line =
242 profiles::internal::CreateProfileShortcutFlags(profile_path);
242 std::vector<FilePath> shortcuts; 243 std::vector<FilePath> shortcuts;
243 ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, &shortcuts); 244 ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, false,
245 &shortcuts);
244 246
245 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); 247 BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
246 for (size_t i = 0; i < shortcuts.size(); ++i) { 248 for (size_t i = 0; i < shortcuts.size(); ++i) {
247 const string16 shortcut_name = 249 const string16 shortcut_name =
248 shortcuts[i].BaseName().RemoveExtension().value(); 250 shortcuts[i].BaseName().RemoveExtension().value();
249 ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, 251 ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
250 distribution, chrome_exe.value(), 252 distribution, chrome_exe.value(),
251 ShellUtil::CURRENT_USER, 253 ShellUtil::CURRENT_USER,
252 &shortcut_name); 254 &shortcut_name);
253 } 255 }
(...skipping 10 matching lines...) Expand all
264 BrowserDistribution* distribution) { 266 BrowserDistribution* distribution) {
265 string16 shortcut_name; 267 string16 shortcut_name;
266 if (!profile_name.empty()) { 268 if (!profile_name.empty()) {
267 shortcut_name.append(profile_name); 269 shortcut_name.append(profile_name);
268 shortcut_name.append(L" - "); 270 shortcut_name.append(L" - ");
269 } 271 }
270 shortcut_name.append(distribution->GetAppShortCutName()); 272 shortcut_name.append(distribution->GetAppShortCutName());
271 return shortcut_name + installer::kLnkExt; 273 return shortcut_name + installer::kLnkExt;
272 } 274 }
273 275
276 string16 CreateProfileShortcutFlags(const FilePath& profile_path) {
277 return base::StringPrintf(L"--%ls=\"%ls\"",
278 ASCIIToUTF16(switches::kProfileDirectory).c_str(),
279 profile_path.BaseName().value().c_str());
280 }
281
274 } // namespace internal 282 } // namespace internal
275 } // namespace profiles 283 } // namespace profiles
276 284
277 // static 285 // static
278 bool ProfileShortcutManager::IsFeatureEnabled() { 286 bool ProfileShortcutManager::IsFeatureEnabled() {
279 return false; 287 return false;
280 } 288 }
281 289
282 // static 290 // static
283 ProfileShortcutManager* ProfileShortcutManager::Create( 291 ProfileShortcutManager* ProfileShortcutManager::Create(
284 ProfileManager* manager) { 292 ProfileManager* manager) {
285 return new ProfileShortcutManagerWin(manager); 293 return new ProfileShortcutManagerWin(manager);
286 } 294 }
287 295
288 ProfileShortcutManagerWin::ProfileShortcutManagerWin(ProfileManager* manager) 296 ProfileShortcutManagerWin::ProfileShortcutManagerWin(ProfileManager* manager)
289 : profile_manager_(manager) { 297 : profile_manager_(manager) {
290 profile_manager_->GetProfileInfoCache().AddObserver(this); 298 profile_manager_->GetProfileInfoCache().AddObserver(this);
291 } 299 }
292 300
293 ProfileShortcutManagerWin::~ProfileShortcutManagerWin() { 301 ProfileShortcutManagerWin::~ProfileShortcutManagerWin() {
294 profile_manager_->GetProfileInfoCache().RemoveObserver(this); 302 profile_manager_->GetProfileInfoCache().RemoveObserver(this);
295 } 303 }
296 304
297 void ProfileShortcutManagerWin::CreateProfileShortcut( 305 void ProfileShortcutManagerWin::CreateProfileShortcut(
298 const FilePath& profile_path) { 306 const FilePath& profile_path) {
299 UpdateShortcutsForProfileAtPath(profile_path, true); 307 UpdateShortcutsForProfileAtPath(profile_path, false, true);
300 } 308 }
301 309
302 void ProfileShortcutManagerWin::OnProfileAdded(const FilePath& profile_path) { 310 void ProfileShortcutManagerWin::OnProfileAdded(const FilePath& profile_path) {
303 const size_t profile_count = 311 const size_t profile_count =
304 profile_manager_->GetProfileInfoCache().GetNumberOfProfiles(); 312 profile_manager_->GetProfileInfoCache().GetNumberOfProfiles();
305 if (profile_count == 1) { 313 if (profile_count == 1) {
306 UpdateShortcutsForProfileAtPath(profile_path, true); 314 UpdateShortcutsForProfileAtPath(profile_path, true, true);
sail 2012/11/26 21:27:16 these UpdateShortcutsForProfileAtPath() calls are
Alexei Svitkine (slow) 2012/11/27 22:31:26 Done. Let me know if you have better suggestions f
307 } else if (profile_count == 2) { 315 } else if (profile_count == 2) {
308 UpdateShortcutsForProfileAtPath(GetOtherProfilePath(profile_path), false); 316 UpdateShortcutsForProfileAtPath(GetOtherProfilePath(profile_path), true,
317 false);
309 } 318 }
310 } 319 }
311 320
312 void ProfileShortcutManagerWin::OnProfileWillBeRemoved( 321 void ProfileShortcutManagerWin::OnProfileWillBeRemoved(
313 const FilePath& profile_path) { 322 const FilePath& profile_path) {
314 } 323 }
315 324
316 void ProfileShortcutManagerWin::OnProfileWasRemoved( 325 void ProfileShortcutManagerWin::OnProfileWasRemoved(
317 const FilePath& profile_path, 326 const FilePath& profile_path,
318 const string16& profile_name) { 327 const string16& profile_name) {
319 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); 328 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
320 // If there is only one profile remaining, remove the badging information 329 // If there is only one profile remaining, remove the badging information
321 // from an existing shortcut. 330 // from an existing shortcut.
322 if (cache.GetNumberOfProfiles() == 1) 331 if (cache.GetNumberOfProfiles() == 1)
323 UpdateShortcutsForProfileAtPath(cache.GetPathOfProfileAtIndex(0), false); 332 UpdateShortcutsForProfileAtPath(cache.GetPathOfProfileAtIndex(0), false,
333 false);
sail 2012/11/26 21:27:16 indentation looks wrong here
Alexei Svitkine (slow) 2012/11/27 22:31:26 Done.
324 334
325 const FilePath icon_path = profile_path.AppendASCII(kProfileIconFileName); 335 const FilePath icon_path = profile_path.AppendASCII(kProfileIconFileName);
326 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 336 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
327 base::Bind(&DeleteDesktopShortcutsAndIconFile, 337 base::Bind(&DeleteDesktopShortcutsAndIconFile,
328 profile_path, icon_path)); 338 profile_path, icon_path));
329 } 339 }
330 340
331 void ProfileShortcutManagerWin::OnProfileNameChanged( 341 void ProfileShortcutManagerWin::OnProfileNameChanged(
332 const FilePath& profile_path, 342 const FilePath& profile_path,
333 const string16& old_profile_name) { 343 const string16& old_profile_name) {
334 UpdateShortcutsForProfileAtPath(profile_path, false); 344 UpdateShortcutsForProfileAtPath(profile_path, false, false);
335 } 345 }
336 346
337 void ProfileShortcutManagerWin::OnProfileAvatarChanged( 347 void ProfileShortcutManagerWin::OnProfileAvatarChanged(
338 const FilePath& profile_path) { 348 const FilePath& profile_path) {
339 UpdateShortcutsForProfileAtPath(profile_path, false); 349 UpdateShortcutsForProfileAtPath(profile_path, false, false);
340 } 350 }
341 351
342 void ProfileShortcutManagerWin::StartProfileShortcutNameChange( 352 void ProfileShortcutManagerWin::StartProfileShortcutNameChange(
343 const FilePath& profile_path, 353 const FilePath& profile_path,
344 const string16& old_profile_name) { 354 const string16& old_profile_name) {
345 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); 355 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
346 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); 356 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path);
347 if (profile_index == std::string::npos) 357 if (profile_index == std::string::npos)
348 return; 358 return;
349 // If the shortcut will have an appended name, get the profile name. 359 // If the shortcut will have an appended name, get the profile name.
(...skipping 22 matching lines...) Expand all
372 // Get the index of the current profile, in order to find the index of the 382 // Get the index of the current profile, in order to find the index of the
373 // other profile. 383 // other profile.
374 size_t current_profile_index = cache.GetIndexOfProfileWithPath(profile_path); 384 size_t current_profile_index = cache.GetIndexOfProfileWithPath(profile_path);
375 size_t other_profile_index = (current_profile_index == 0) ? 1 : 0; 385 size_t other_profile_index = (current_profile_index == 0) ? 1 : 0;
376 return profile_manager_->GetProfileInfoCache(). 386 return profile_manager_->GetProfileInfoCache().
377 GetPathOfProfileAtIndex(other_profile_index); 387 GetPathOfProfileAtIndex(other_profile_index);
378 } 388 }
379 389
380 void ProfileShortcutManagerWin::UpdateShortcutsForProfileAtPath( 390 void ProfileShortcutManagerWin::UpdateShortcutsForProfileAtPath(
381 const FilePath& profile_path, 391 const FilePath& profile_path,
392 bool include_empty_command_lines,
sail 2012/11/26 21:27:16 this name is too implementation specific. Maybe pi
Alexei Svitkine (slow) 2012/11/27 22:31:26 Hopefully, this should be clearer with the enum pa
382 bool create_always) { 393 bool create_always) {
383 ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache(); 394 ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache();
384 size_t profile_index = cache->GetIndexOfProfileWithPath(profile_path); 395 size_t profile_index = cache->GetIndexOfProfileWithPath(profile_path);
385 if (profile_index == std::string::npos) 396 if (profile_index == std::string::npos)
386 return; 397 return;
387 bool remove_badging = cache->GetNumberOfProfiles() == 1; 398 bool remove_badging = cache->GetNumberOfProfiles() == 1;
388 399
389 string16 old_shortcut_appended_name = 400 string16 old_shortcut_appended_name =
390 cache->GetShortcutNameOfProfileAtIndex(profile_index); 401 cache->GetShortcutNameOfProfileAtIndex(profile_index);
391 402
(...skipping 19 matching lines...) Expand all
411 const SkBitmap* profile_avatar_bitmap = profile_avatar_image.ToSkBitmap(); 422 const SkBitmap* profile_avatar_bitmap = profile_avatar_image.ToSkBitmap();
412 // Make a copy of the SkBitmap to ensure that we can safely use the image 423 // Make a copy of the SkBitmap to ensure that we can safely use the image
413 // data on the FILE thread. 424 // data on the FILE thread.
414 profile_avatar_bitmap->deepCopyTo(&profile_avatar_bitmap_copy, 425 profile_avatar_bitmap->deepCopyTo(&profile_avatar_bitmap_copy,
415 profile_avatar_bitmap->getConfig()); 426 profile_avatar_bitmap->getConfig());
416 } 427 }
417 BrowserThread::PostTask( 428 BrowserThread::PostTask(
418 BrowserThread::FILE, FROM_HERE, 429 BrowserThread::FILE, FROM_HERE,
419 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, 430 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile,
420 profile_path, new_shortcut_appended_name, 431 profile_path, new_shortcut_appended_name,
421 profile_avatar_bitmap_copy, create_always)); 432 profile_avatar_bitmap_copy, include_empty_command_lines,
433 create_always));
422 434
423 cache->SetShortcutNameOfProfileAtIndex(profile_index, 435 cache->SetShortcutNameOfProfileAtIndex(profile_index,
424 new_shortcut_appended_name); 436 new_shortcut_appended_name);
425 } 437 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698