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

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: reinstate ash browser test fix 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..c9bbfbd094d2b64f25888ad0103291f574537fa0 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,11 +21,16 @@ void AvatarButtonManager::Update(AvatarButtonStyle style) {
// This should never be called in incognito mode.
DCHECK(browser_view->IsRegularOrGuestSession());
-
- if (browser_view->ShouldShowAvatar()) {
+ ProfileAttributesEntry* unused;
+ if (browser_view->IsBrowserTypeNormal() &&
+ // Tests may not have a profile manager.
+ g_browser_process->profile_manager() &&
+ g_browser_process->profile_manager()
+ ->GetProfileAttributesStorage()
+ .GetProfileAttributesWithPath(profile->GetPath(), &unused)) {
if (!view_) {
view_ = new NewAvatarButton(this, style, profile);
- view_->set_id(VIEW_ID_NEW_AVATAR_BUTTON);
+ view_->set_id(VIEW_ID_AVATAR_BUTTON);
frame_view_->AddChildView(view_);
frame->GetRootView()->Layout();
}
« no previous file with comments | « chrome/browser/ui/views/apps/chrome_native_app_window_views.cc ('k') | chrome/browser/ui/views/frame/browser_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698