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

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

Issue 1682603002: [UI Views] Don't allow a ButtonListener and a MenuButtonListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 4 years, 10 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
« no previous file with comments | « chrome/browser/ui/views/menu_test_base.cc ('k') | chrome/browser/ui/views/tab_icon_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 19 matching lines...) Expand all
30 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
31 31
32 static inline int Round(double x) { 32 static inline int Round(double x) {
33 return static_cast<int>(x + 0.5); 33 return static_cast<int>(x + 0.5);
34 } 34 }
35 35
36 // static 36 // static
37 const char AvatarMenuButton::kViewClassName[] = "AvatarMenuButton"; 37 const char AvatarMenuButton::kViewClassName[] = "AvatarMenuButton";
38 38
39 AvatarMenuButton::AvatarMenuButton(BrowserView* browser_view) 39 AvatarMenuButton::AvatarMenuButton(BrowserView* browser_view)
40 : MenuButton(NULL, base::string16(), this, false), 40 : MenuButton(base::string16(), this, false),
41 browser_view_(browser_view), 41 browser_view_(browser_view),
42 enabled_(browser_view_->IsRegularOrGuestSession()), 42 enabled_(browser_view_->IsRegularOrGuestSession()),
43 is_rectangle_(false), 43 is_rectangle_(false),
44 old_height_(0) { 44 old_height_(0) {
45 // In RTL mode, the avatar icon should be looking the opposite direction. 45 // In RTL mode, the avatar icon should be looking the opposite direction.
46 EnableCanvasFlippingForRTLUI(true); 46 EnableCanvasFlippingForRTLUI(true);
47 47
48 SetEventTargeter( 48 SetEventTargeter(
49 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); 49 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
50 } 50 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return enabled_ && 148 return enabled_ &&
149 views::ViewTargeterDelegate::DoesIntersectRect(target, rect); 149 views::ViewTargeterDelegate::DoesIntersectRect(target, rect);
150 } 150 }
151 151
152 // views::MenuButtonListener implementation 152 // views::MenuButtonListener implementation
153 void AvatarMenuButton::OnMenuButtonClicked(views::View* source, 153 void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
154 const gfx::Point& point) { 154 const gfx::Point& point) {
155 if (enabled_) 155 if (enabled_)
156 chrome::ShowAvatarMenu(browser_view_->browser()); 156 chrome::ShowAvatarMenu(browser_view_->browser());
157 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/menu_test_base.cc ('k') | chrome/browser/ui/views/tab_icon_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698