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

Unified Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 8511064: GAIA Profile info prototype (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/avatar_menu_model.cc
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 7126fc122f596eb7ac401d23683552a3d9d523db..73de8dbf72e8d7bb85e01376e2ad24cb0e7c3463 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -22,6 +22,8 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"
+#include "skia/ext/image_operations.h"
+#include "ui/gfx/canvas_skia.h"
using content::BrowserThread;
@@ -152,7 +154,39 @@ void AvatarMenuModel::RebuildMenu() {
const size_t count = profile_info_->GetNumberOfProfiles();
for (size_t i = 0; i < count; ++i) {
- Item* item = new Item(i, profile_info_->GetAvatarIconOfProfileAtIndex(i));
+ Item* item = NULL;
+ if (profile_info_->IsUsingCustomAvatarIconForProfileAtIndex(i)) {
+ SkBitmap custom_bmp =
+ profile_info_->GetGAIAPictureOfProfileAtIndex(i);
+ SkBitmap rimage = skia::ImageOperations::Resize(
+ custom_bmp, skia::ImageOperations::RESIZE_BEST, 29, 29);
+
+ gfx::CanvasSkia canvas(38, 31, false);
+ // canvas.FillRect(SkColorSetRGB(0xff, 0, 0), gfx::Rect(0, 0, 39, 32));
+ canvas.DrawBitmapInt(rimage, 4, 1);
+
+ int x1 = 4;
+ int y1 = 1;
+ int x2 = x1 + 29;
+ int y2 = y1 + 29;
+
+ // Dark Shadow Top
+ canvas.DrawLineInt(SkColorSetARGB(89, 0, 0, 0),
+ x1 - 1, y1 - 1, x2 + 1, y1 - 1);
+ canvas.DrawLineInt(SkColorSetARGB(89, 0, 0, 0),
+ x1 - 1, y1, x1 - 1, y2);
+ canvas.DrawLineInt(SkColorSetARGB(89, 0, 0, 0),
+ x2, y1, x2, y2);
+ canvas.DrawLineInt(SkColorSetARGB(89, 0, 0, 0),
+ x1 - 1, y2 + 0, x2 + 1, y2 + 0);
+
+ SkBitmap bmp = canvas.ExtractBitmap();
+
+ gfx::Image image2(new SkBitmap(bmp));
+ item = new Item(i, image2);
+ } else {
+ item = new Item(i, profile_info_->GetAvatarIconOfProfileAtIndex(i));
+ }
item->name = profile_info_->GetNameOfProfileAtIndex(i);
item->sync_state = profile_info_->GetUserNameOfProfileAtIndex(i);
if (item->sync_state.empty()) {
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698