| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 *source_bitmap, | 92 *source_bitmap, |
| 93 skia::ImageOperations::RESIZE_LANCZOS3, | 93 skia::ImageOperations::RESIZE_LANCZOS3, |
| 94 kProfileAvatarShortcutBadgeWidth, | 94 kProfileAvatarShortcutBadgeWidth, |
| 95 kProfileAvatarShortcutBadgeHeight); | 95 kProfileAvatarShortcutBadgeHeight); |
| 96 | 96 |
| 97 // Overlay the avatar on the icon, anchoring it to the bottom-right of the | 97 // Overlay the avatar on the icon, anchoring it to the bottom-right of the |
| 98 // icon. | 98 // icon. |
| 99 scoped_ptr<SkCanvas> offscreen_canvas( | 99 scoped_ptr<SkCanvas> offscreen_canvas( |
| 100 skia::CreateBitmapCanvas(app_icon_bitmap->width(), | 100 skia::CreateBitmapCanvas(app_icon_bitmap->width(), |
| 101 app_icon_bitmap->height(), | 101 app_icon_bitmap->height(), |
| 102 false)); | 102 skia::PlatformDevice::FLAGS_NONE)); |
| 103 DCHECK(offscreen_canvas.get()); | 103 DCHECK(offscreen_canvas.get()); |
| 104 offscreen_canvas->drawBitmap(*app_icon_bitmap, 0, 0); | 104 offscreen_canvas->drawBitmap(*app_icon_bitmap, 0, 0); |
| 105 offscreen_canvas->drawBitmap( | 105 offscreen_canvas->drawBitmap( |
| 106 sk_icon, | 106 sk_icon, |
| 107 app_icon_bitmap->width() - kProfileAvatarShortcutBadgeWidth, | 107 app_icon_bitmap->width() - kProfileAvatarShortcutBadgeWidth, |
| 108 app_icon_bitmap->height() - kProfileAvatarShortcutBadgeHeight); | 108 app_icon_bitmap->height() - kProfileAvatarShortcutBadgeHeight); |
| 109 const SkBitmap& final_bitmap = | 109 const SkBitmap& final_bitmap = |
| 110 offscreen_canvas->getDevice()->accessBitmap(false); | 110 offscreen_canvas->getDevice()->accessBitmap(false); |
| 111 | 111 |
| 112 // Finally, write the .ico file containing this new bitmap. | 112 // Finally, write the .ico file containing this new bitmap. |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 shortcuts.reserve(profile_names.size()); | 421 shortcuts.reserve(profile_names.size()); |
| 422 for (std::vector<string16>::const_iterator it = profile_names.begin(); | 422 for (std::vector<string16>::const_iterator it = profile_names.begin(); |
| 423 it != profile_names.end(); | 423 it != profile_names.end(); |
| 424 ++it) { | 424 ++it) { |
| 425 string16 shortcut; | 425 string16 shortcut; |
| 426 if (ShellUtil::GetChromeShortcutName(dist, false, *it, &shortcut)) | 426 if (ShellUtil::GetChromeShortcutName(dist, false, *it, &shortcut)) |
| 427 shortcuts.push_back(shortcut); | 427 shortcuts.push_back(shortcut); |
| 428 } | 428 } |
| 429 return shortcuts; | 429 return shortcuts; |
| 430 } | 430 } |
| OLD | NEW |