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

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

Issue 1307093004: Remove references to IsNewAvatarMenu since the flag was removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review feedback Created 5 years, 2 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/avatar_menu_button.h" 5 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 taskbar_badge_avatar, 114 taskbar_badge_avatar,
115 &is_badge_rectangle); 115 &is_badge_rectangle);
116 #endif 116 #endif
117 } else if (should_show_avatar_menu) { 117 } else if (should_show_avatar_menu) {
118 ProfileInfoCache& cache = 118 ProfileInfoCache& cache =
119 g_browser_process->profile_manager()->GetProfileInfoCache(); 119 g_browser_process->profile_manager()->GetProfileInfoCache();
120 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 120 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
121 if (index == std::string::npos) 121 if (index == std::string::npos)
122 return false; 122 return false;
123 123
124 if (switches::IsNewAvatarMenu()) { 124 #if defined(OS_CHROMEOS)
125 *avatar = cache.GetAvatarIconOfProfileAtIndex(index); 125 AvatarMenu::GetImageForMenuButton(profile->GetPath(),
126 // TODO(noms): Once the code for the old avatar menu button is removed, 126 avatar,
127 // this function will only be called for badging the taskbar icon. The 127 is_rectangle);
Peter Kasting 2015/09/29 20:34:16 Nit: All fits on one line, I think: AvatarMen
anthonyvd 2015/09/30 18:34:03 Done.
128 // function can be renamed to something like GetAvatarImageForBadging() 128 #else
129 // and only needs to return the avatar from 129 *avatar = cache.GetAvatarIconOfProfileAtIndex(index);
130 // AvatarMenu::GetImageForMenuButton(). 130 // TODO(noms): Once the code for the old avatar menu button is removed,
131 #if !defined(OS_CHROMEOS) 131 // this function will only be called for badging the taskbar icon. The
132 bool is_badge_rectangle = false; 132 // function can be renamed to something like GetAvatarImageForBadging()
133 AvatarMenu::GetImageForMenuButton(profile->GetPath(), 133 // and only needs to return the avatar from
134 taskbar_badge_avatar, 134 // AvatarMenu::GetImageForMenuButton().
135 &is_badge_rectangle); 135 bool is_badge_rectangle = false;
136 AvatarMenu::GetImageForMenuButton(profile->GetPath(),
137 taskbar_badge_avatar,
138 &is_badge_rectangle);
136 #endif 139 #endif
137 } else {
138 AvatarMenu::GetImageForMenuButton(profile->GetPath(),
139 avatar,
140 is_rectangle);
141 }
142 } 140 }
143 return true; 141 return true;
144 } 142 }
145 143
146 // views::ViewTargeterDelegate: 144 // views::ViewTargeterDelegate:
147 bool AvatarMenuButton::DoesIntersectRect(const views::View* target, 145 bool AvatarMenuButton::DoesIntersectRect(const views::View* target,
148 const gfx::Rect& rect) const { 146 const gfx::Rect& rect) const {
149 CHECK_EQ(target, this); 147 CHECK_EQ(target, this);
150 return !disabled_ && 148 return !disabled_ &&
151 views::ViewTargeterDelegate::DoesIntersectRect(target, rect); 149 views::ViewTargeterDelegate::DoesIntersectRect(target, rect);
152 } 150 }
153 151
154 // views::MenuButtonListener implementation 152 // views::MenuButtonListener implementation
155 void AvatarMenuButton::OnMenuButtonClicked(views::View* source, 153 void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
156 const gfx::Point& point) { 154 const gfx::Point& point) {
157 if (!disabled_) 155 if (!disabled_)
158 chrome::ShowAvatarMenu(browser_); 156 chrome::ShowAvatarMenu(browser_);
159 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698