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_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 offscreen_canvas->drawBitmap( | 85 offscreen_canvas->drawBitmap( |
86 sk_icon, | 86 sk_icon, |
87 app_icon_bitmap->width() - kProfileAvatarShortcutBadgeWidth, | 87 app_icon_bitmap->width() - kProfileAvatarShortcutBadgeWidth, |
88 app_icon_bitmap->height() - kProfileAvatarShortcutBadgeHeight); | 88 app_icon_bitmap->height() - kProfileAvatarShortcutBadgeHeight); |
89 const SkBitmap& final_bitmap = | 89 const SkBitmap& final_bitmap = |
90 offscreen_canvas->getDevice()->accessBitmap(false); | 90 offscreen_canvas->getDevice()->accessBitmap(false); |
91 | 91 |
92 // Finally, write the .ico file containing this new bitmap. | 92 // Finally, write the .ico file containing this new bitmap. |
93 const FilePath icon_path = | 93 const FilePath icon_path = |
94 profile_path.AppendASCII(profiles::internal::kProfileIconFileName); | 94 profile_path.AppendASCII(profiles::internal::kProfileIconFileName); |
95 if (!IconUtil::CreateIconFileFromSkBitmap(final_bitmap, icon_path)) | 95 // TODO(asvitkine): Create icon with a large 256x256 bitmap. |
| 96 if (!IconUtil::CreateIconFileFromSkBitmap(final_bitmap, SkBitmap(), |
| 97 icon_path)) |
96 return FilePath(); | 98 return FilePath(); |
97 | 99 |
98 return icon_path; | 100 return icon_path; |
99 } | 101 } |
100 | 102 |
101 // Gets the directory where to create desktop shortcuts. | 103 // Gets the directory where to create desktop shortcuts. |
102 bool GetDesktopShortcutsDirectory(FilePath* directory) { | 104 bool GetDesktopShortcutsDirectory(FilePath* directory) { |
103 const bool result = | 105 const bool result = |
104 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, | 106 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
105 BrowserDistribution::GetDistribution(), | 107 BrowserDistribution::GetDistribution(), |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 461 } |
460 BrowserThread::PostTask( | 462 BrowserThread::PostTask( |
461 BrowserThread::FILE, FROM_HERE, | 463 BrowserThread::FILE, FROM_HERE, |
462 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, | 464 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, |
463 profile_path, new_shortcut_appended_name, | 465 profile_path, new_shortcut_appended_name, |
464 profile_avatar_bitmap_copy, create_mode, action)); | 466 profile_avatar_bitmap_copy, create_mode, action)); |
465 | 467 |
466 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 468 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
467 new_shortcut_appended_name); | 469 new_shortcut_appended_name); |
468 } | 470 } |
OLD | NEW |