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

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(), avatar, is_rectangle);
126 // TODO(noms): Once the code for the old avatar menu button is removed, 126 #else
127 // this function will only be called for badging the taskbar icon. The 127 *avatar = cache.GetAvatarIconOfProfileAtIndex(index);
128 // function can be renamed to something like GetAvatarImageForBadging() 128 // TODO(noms): Once the code for the old avatar menu button is removed,
129 // and only needs to return the avatar from 129 // this function will only be called for badging the taskbar icon. The
130 // AvatarMenu::GetImageForMenuButton(). 130 // function can be renamed to something like GetAvatarImageForBadging()
131 #if !defined(OS_CHROMEOS) 131 // and only needs to return the avatar from
132 bool is_badge_rectangle = false; 132 // AvatarMenu::GetImageForMenuButton().
133 AvatarMenu::GetImageForMenuButton(profile->GetPath(), 133 bool is_badge_rectangle = false;
134 taskbar_badge_avatar, 134 AvatarMenu::GetImageForMenuButton(profile->GetPath(),
135 &is_badge_rectangle); 135 taskbar_badge_avatar,
136 &is_badge_rectangle);
136 #endif 137 #endif
137 } else {
138 AvatarMenu::GetImageForMenuButton(profile->GetPath(),
139 avatar,
140 is_rectangle);
141 }
142 } 138 }
143 return true; 139 return true;
144 } 140 }
145 141
146 // views::ViewTargeterDelegate: 142 // views::ViewTargeterDelegate:
147 bool AvatarMenuButton::DoesIntersectRect(const views::View* target, 143 bool AvatarMenuButton::DoesIntersectRect(const views::View* target,
148 const gfx::Rect& rect) const { 144 const gfx::Rect& rect) const {
149 CHECK_EQ(target, this); 145 CHECK_EQ(target, this);
150 return !disabled_ && 146 return !disabled_ &&
151 views::ViewTargeterDelegate::DoesIntersectRect(target, rect); 147 views::ViewTargeterDelegate::DoesIntersectRect(target, rect);
152 } 148 }
153 149
154 // views::MenuButtonListener implementation 150 // views::MenuButtonListener implementation
155 void AvatarMenuButton::OnMenuButtonClicked(views::View* source, 151 void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
156 const gfx::Point& point) { 152 const gfx::Point& point) {
157 if (!disabled_) 153 if (!disabled_)
158 chrome::ShowAvatarMenu(browser_); 154 chrome::ShowAvatarMenu(browser_);
159 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698