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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm

Issue 471333003: Make sure avatar menu does not use account_id for display purposes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 7198d96d9d1d6146d5026bdfd79803edcfec0e48..586bb4bcdcfa6a6d1b8106213aea10c3d849faa6 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -42,10 +42,10 @@
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
-#include "components/signin/core/common/profile_management_switches.h"
#include "components/signin/core/browser/mutable_profile_oauth2_token_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
+#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "google_apis/gaia/oauth2_token_service.h"
@@ -861,7 +861,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// |reauthRequired| is true, the button also displays a warning icon. |tag|
// indicates which account the button refers to.
- (NSButton*)accountButtonWithRect:(NSRect)rect
- title:(const std::string&)title
+ account_id:(const std::string&)account_id
tag:(int)tag
reauthRequired:(BOOL)reauthRequired;
@@ -1807,7 +1807,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
currentProfileAccounts_[i] = accounts[i];
NSButton* accountButton =
[self accountButtonWithRect:rect
- title:accounts[i]
+ account_id:accounts[i]
tag:i
reauthRequired:errorAccountId == accounts[i]];
[container addSubview:accountButton];
@@ -1817,7 +1817,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// The primary account should always be listed first.
NSButton* accountButton =
[self accountButtonWithRect:rect
- title:primaryAccount
+ account_id:primaryAccount
guohui 2014/08/21 19:01:52 primaryAccount is filled with the authenticated us
Roger Tawa OOO till Jul 10th 2014/08/21 20:39:25 Done.
tag:kPrimaryProfileTag
reauthRequired:errorAccountId == primaryAccount];
[container addSubview:accountButton];
@@ -2089,9 +2089,13 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
}
- (NSButton*)accountButtonWithRect:(NSRect)rect
- title:(const std::string&)title
+ account_id:(const std::string&)account_id
tag:(int)tag
reauthRequired:(BOOL)reauthRequired {
+ // Get display email address for account.
+ std::string email = signin_ui_util::GetDisplayEmail(browser_->profile(),
+ account_id);
+
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
NSImage* deleteImage = rb->GetNativeImageNamed(IDR_CLOSE_1).ToNSImage();
CGFloat deleteImageWidth = [deleteImage size].width;
@@ -2110,7 +2114,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[[BackgroundColorHoverButton alloc] initWithFrame:rect
imageTitleSpacing:0
backgroundColor:backgroundColor]);
- [button setTitle:ElideEmail(title, availableTextWidth)];
+ [button setTitle:ElideEmail(email, availableTextWidth)];
[button setAlignment:NSLeftTextAlignment];
[button setBordered:NO];
if (reauthRequired) {

Powered by Google App Engine
This is Rietveld 408576698