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

Side by Side Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 1117453002: Add gaia_id to ProfileInfoCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments 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 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" 5 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
6 6
7 #include "base/win/windows_version.h" 7 #include "base/win/windows_version.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/profiles/profiles_state.h" 10 #include "chrome/browser/profiles/profiles_state.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 void NewAvatarButton::Update() { 170 void NewAvatarButton::Update() {
171 const ProfileInfoCache& cache = 171 const ProfileInfoCache& cache =
172 g_browser_process->profile_manager()->GetProfileInfoCache(); 172 g_browser_process->profile_manager()->GetProfileInfoCache();
173 173
174 // If we have a single local profile, then use the generic avatar 174 // If we have a single local profile, then use the generic avatar
175 // button instead of the profile name. Never use the generic button if 175 // button instead of the profile name. Never use the generic button if
176 // the active profile is Guest. 176 // the active profile is Guest.
177 bool use_generic_button = (!browser_->profile()->IsGuestSession() && 177 bool use_generic_button = (!browser_->profile()->IsGuestSession() &&
178 cache.GetNumberOfProfiles() == 1 && 178 cache.GetNumberOfProfiles() == 1 &&
179 cache.GetUserNameOfProfileAtIndex(0).empty()); 179 !cache.ProfileIsAuthenticatedAtIndex(0));
180 180
181 SetText(use_generic_button ? base::string16() : 181 SetText(use_generic_button ? base::string16() :
182 profiles::GetAvatarButtonTextForProfile(browser_->profile())); 182 profiles::GetAvatarButtonTextForProfile(browser_->profile()));
183 183
184 // If the button has no text, clear the text shadows to make sure the 184 // If the button has no text, clear the text shadows to make sure the
185 // image is centered correctly. 185 // image is centered correctly.
186 SetTextShadows( 186 SetTextShadows(
187 use_generic_button 187 use_generic_button
188 ? gfx::ShadowValues() 188 ? gfx::ShadowValues()
189 : gfx::ShadowValues( 189 : gfx::ShadowValues(
(...skipping 12 matching lines...) Expand all
202 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); 202 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia());
203 } 203 }
204 204
205 // If we are not using the generic button, then reset the spacing between 205 // If we are not using the generic button, then reset the spacing between
206 // the text and the possible authentication error icon. 206 // the text and the possible authentication error icon.
207 const int kDefaultImageTextSpacing = 5; 207 const int kDefaultImageTextSpacing = 5;
208 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); 208 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing);
209 209
210 PreferredSizeChanged(); 210 PreferredSizeChanged();
211 } 211 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/avatar_menu_bubble_view.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698