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

Unified Diff: chrome/browser/ui/views/frame/avatar_button_manager.cc

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/avatar_button_manager.cc
diff --git a/chrome/browser/ui/views/frame/avatar_button_manager.cc b/chrome/browser/ui/views/frame/avatar_button_manager.cc
index c5ebffc22e9ee50fe67c1ddcef8a2fad7b010391..cd82ebda2156e5445f15472c9d7315029fae8ef4 100644
--- a/chrome/browser/ui/views/frame/avatar_button_manager.cc
+++ b/chrome/browser/ui/views/frame/avatar_button_manager.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/views/frame/avatar_button_manager.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -19,8 +21,16 @@ void AvatarButtonManager::Update(AvatarButtonStyle style) {
// This should never be called in incognito mode.
DCHECK(browser_view->IsRegularOrGuestSession());
+ ProfileAttributesEntry* entry;
+ bool show_avatar =
Peter Kasting 2016/05/17 03:51:42 Nit: I'd just inline this into the next statement.
Evan Stade 2016/05/17 18:13:08 Done.
+ browser_view->IsBrowserTypeNormal() &&
+ // Tests may not have a profile manager.
+ g_browser_process->profile_manager() &&
+ g_browser_process->profile_manager()
+ ->GetProfileAttributesStorage()
+ .GetProfileAttributesWithPath(profile->GetPath(), &entry);
- if (browser_view->ShouldShowAvatar()) {
+ if (show_avatar) {
if (!view_) {
view_ = new NewAvatarButton(this, style, profile);
view_->set_id(VIEW_ID_NEW_AVATAR_BUTTON);

Powered by Google App Engine
This is Rietveld 408576698