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

Unified Diff: chrome/browser/ui/cocoa/browser/avatar_button_controller.mm

Issue 8671002: Cocoa: Custom drawing for GAIA avatar pictures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
index 3537ad9af71fec8e16c557ccf39d1546369a06f9..66ba5d259239d647640ea18086ee666c3b1c03d7 100644
--- a/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
+++ b/chrome/browser/ui/cocoa/browser/avatar_button_controller.mm
@@ -8,6 +8,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
+#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
@@ -122,7 +123,8 @@ const CGFloat kMenuYOffsetAdjust = 1.0;
[self setView:button];
if (browser_->profile()->IsOffTheRecord()) {
- [self setImage:gfx::GetCachedImageWithName(@"otr_icon.pdf")];
+ [self setImage:[self compositeImageWithShadow:
+ gfx::GetCachedImageWithName(@"otr_icon.pdf")]];
[self setOpenMenuOnClick:NO];
} else {
observer_.reset(new AvatarButtonControllerInternal::Observer(self));
@@ -146,7 +148,7 @@ const CGFloat kMenuYOffsetAdjust = 1.0;
}
- (void)setImage:(NSImage*)image {
- [self.buttonView setImage:[self compositeImageWithShadow:image]];
+ [self.buttonView setImage:image];
sail 2011/11/26 06:52:00 I moved this so that it only applies to the incogn
}
- (void)showAvatarBubble {
@@ -237,7 +239,13 @@ const CGFloat kMenuYOffsetAdjust = 1.0;
size_t index =
cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath());
if (index != std::string::npos) {
- [self setImage:cache.GetAvatarIconOfProfileAtIndex(index).ToNSImage()];
+ bool is_gaia_picture =
Robert Sesek 2011/11/28 19:17:53 BOOL
sail 2011/11/28 19:40:31 Done.
+ cache.IsUsingGAIAPictureOfProfileAtIndex(index) &&
+ !cache.GetGAIAPictureOfProfileAtIndex(index).IsNull();
+ gfx::Image icon = profiles::GetAvatarIconForTitleBar(
+ cache.GetAvatarIconOfProfileAtIndex(index), is_gaia_picture,
+ profiles::kAvatarIconWidth, profiles::kAvatarIconHeight);
+ [self setImage:icon.ToNSImage()];
const string16& name = cache.GetNameOfProfileAtIndex(index);
NSString* nsName = base::SysUTF16ToNSString(name);

Powered by Google App Engine
This is Rietveld 408576698