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

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

Issue 212603011: Newly created profiles should have the grey silhouette as avatar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove duplicate references to resource for grey avatar. Created 6 years, 9 months 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 <shlobj.h> // For SHChangeNotify(). 7 #include <shlobj.h> // For SHChangeNotify().
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 IDR_PROFILE_AVATAR_2X_16, 96 IDR_PROFILE_AVATAR_2X_16,
97 IDR_PROFILE_AVATAR_2X_17, 97 IDR_PROFILE_AVATAR_2X_17,
98 IDR_PROFILE_AVATAR_2X_18, 98 IDR_PROFILE_AVATAR_2X_18,
99 IDR_PROFILE_AVATAR_2X_19, 99 IDR_PROFILE_AVATAR_2X_19,
100 IDR_PROFILE_AVATAR_2X_20, 100 IDR_PROFILE_AVATAR_2X_20,
101 IDR_PROFILE_AVATAR_2X_21, 101 IDR_PROFILE_AVATAR_2X_21,
102 IDR_PROFILE_AVATAR_2X_22, 102 IDR_PROFILE_AVATAR_2X_22,
103 IDR_PROFILE_AVATAR_2X_23, 103 IDR_PROFILE_AVATAR_2X_23,
104 IDR_PROFILE_AVATAR_2X_24, 104 IDR_PROFILE_AVATAR_2X_24,
105 IDR_PROFILE_AVATAR_2X_25, 105 IDR_PROFILE_AVATAR_2X_25,
106 IDR_PROFILE_AVATAR_2X_26,
106 }; 107 };
107 108
108 // Badges |app_icon_bitmap| with |avatar_bitmap| at the bottom right corner and 109 // Badges |app_icon_bitmap| with |avatar_bitmap| at the bottom right corner and
109 // returns the resulting SkBitmap. 110 // returns the resulting SkBitmap.
110 SkBitmap BadgeIcon(const SkBitmap& app_icon_bitmap, 111 SkBitmap BadgeIcon(const SkBitmap& app_icon_bitmap,
111 const SkBitmap& avatar_bitmap, 112 const SkBitmap& avatar_bitmap,
112 int scale_factor) { 113 int scale_factor) {
113 // TODO(rlp): Share this chunk of code with 114 // TODO(rlp): Share this chunk of code with
114 // avatar_menu_button::DrawTaskBarDecoration. 115 // avatar_menu_button::DrawTaskBarDecoration.
115 SkBitmap source_bitmap = avatar_bitmap; 116 SkBitmap source_bitmap = avatar_bitmap;
116 if ((avatar_bitmap.width() == scale_factor * profiles::kAvatarIconWidth) && 117 if ((avatar_bitmap.width() == scale_factor * profiles::kAvatarIconWidth) &&
117 (avatar_bitmap.height() == scale_factor * profiles::kAvatarIconHeight)) { 118 (avatar_bitmap.height() == scale_factor * profiles::kAvatarIconHeight)) {
118 // Shave a couple of columns so the bitmap is more square. So when 119 // Shave a couple of columns so the bitmap is more square. So when
119 // resized to a square aspect ratio it looks pretty. 120 // resized to a square aspect ratio it looks pretty.
120 gfx::Rect frame(scale_factor * profiles::kAvatarIconWidth, 121 gfx::Rect frame(scale_factor * profiles::kAvatarIconWidth,
121 scale_factor * profiles::kAvatarIconHeight); 122 scale_factor * profiles::kAvatarIconHeight);
122 frame.Inset(scale_factor * 2, 0, scale_factor * 2, 0); 123 frame.Inset(scale_factor * 2, 0, scale_factor * 2, 0);
123 avatar_bitmap.extractSubset(&source_bitmap, gfx::RectToSkIRect(frame)); 124 avatar_bitmap.extractSubset(&source_bitmap, gfx::RectToSkIRect(frame));
124 } else { 125 } else {
125 NOTREACHED(); 126 // Square bitmaps are valid, nothing else should occur.
127 if (avatar_bitmap.width() != avatar_bitmap.height()) {
noms (inactive) 2014/03/27 20:39:53 nit: no brackets. Also: as discussed offline, I do
Mike Lerman 2014/04/02 17:46:25 Nit - Done. Offline discussion - the problem we f
128 NOTREACHED();
129 }
126 } 130 }
127 int avatar_badge_size = kProfileAvatarBadgeSize; 131 int avatar_badge_size = kProfileAvatarBadgeSize;
128 if (app_icon_bitmap.width() != kShortcutIconSize) { 132 if (app_icon_bitmap.width() != kShortcutIconSize) {
129 avatar_badge_size = 133 avatar_badge_size =
130 app_icon_bitmap.width() * kProfileAvatarBadgeSize / kShortcutIconSize; 134 app_icon_bitmap.width() * kProfileAvatarBadgeSize / kShortcutIconSize;
131 } 135 }
132 SkBitmap sk_icon = skia::ImageOperations::Resize( 136 SkBitmap sk_icon = skia::ImageOperations::Resize(
133 source_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, avatar_badge_size, 137 source_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, avatar_badge_size,
134 source_bitmap.height() * avatar_badge_size / source_bitmap.width()); 138 source_bitmap.height() * avatar_badge_size / source_bitmap.width());
135 139
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 // Ensure the profile's icon file has been created. 856 // Ensure the profile's icon file has been created.
853 CreateOrUpdateProfileIcon(profile->GetPath()); 857 CreateOrUpdateProfileIcon(profile->GetPath());
854 } 858 }
855 break; 859 break;
856 } 860 }
857 default: 861 default:
858 NOTREACHED(); 862 NOTREACHED();
859 break; 863 break;
860 } 864 }
861 } 865 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698