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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]]; 218 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]];
219 } 219 }
220 220
221 const ProfileInfoCache& cache = 221 const ProfileInfoCache& cache =
222 g_browser_process->profile_manager()->GetProfileInfoCache(); 222 g_browser_process->profile_manager()->GetProfileInfoCache();
223 // If there is a single local profile, then use the generic avatar button 223 // If there is a single local profile, then use the generic avatar button
224 // instead of the profile name. Never use the generic button if the active 224 // instead of the profile name. Never use the generic button if the active
225 // profile is Guest. 225 // profile is Guest.
226 bool useGenericButton = (!browser_->profile()->IsGuestSession() && 226 bool useGenericButton = (!browser_->profile()->IsGuestSession() &&
227 cache.GetNumberOfProfiles() == 1 && 227 cache.GetNumberOfProfiles() == 1 &&
228 cache.GetUserNameOfProfileAtIndex(0).empty()); 228 !cache.ProfileIsAuthenticatedAtIndex(0));
229 229
230 230
231 NSString* buttonTitle = base::SysUTF16ToNSString(useGenericButton ? 231 NSString* buttonTitle = base::SysUTF16ToNSString(useGenericButton ?
232 base::string16() : 232 base::string16() :
233 profiles::GetAvatarButtonTextForProfile(browser_->profile())); 233 profiles::GetAvatarButtonTextForProfile(browser_->profile()));
234 [[button_ cell] setHasError:hasError_ withTitle:buttonTitle]; 234 [[button_ cell] setHasError:hasError_ withTitle:buttonTitle];
235 235
236 AvatarButton* button = 236 AvatarButton* button =
237 base::mac::ObjCCastStrict<AvatarButton>(button_); 237 base::mac::ObjCCastStrict<AvatarButton>(button_);
238 if (useGenericButton) { 238 if (useGenericButton) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 layoutSubviews]; 283 layoutSubviews];
284 } 284 }
285 } 285 }
286 286
287 - (void)updateErrorStatus:(BOOL)hasError { 287 - (void)updateErrorStatus:(BOOL)hasError {
288 hasError_ = hasError; 288 hasError_ = hasError;
289 [self updateAvatarButtonAndLayoutParent:YES]; 289 [self updateAvatarButtonAndLayoutParent:YES];
290 } 290 }
291 291
292 @end 292 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698