OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 AvatarMenuButton::AvatarMenuButton(BrowserView* browser_view) | 40 AvatarMenuButton::AvatarMenuButton(BrowserView* browser_view) |
41 : MenuButton(base::string16(), this, false), | 41 : MenuButton(base::string16(), this, false), |
42 browser_view_(browser_view), | 42 browser_view_(browser_view), |
43 enabled_(browser_view_->IsRegularOrGuestSession()), | 43 enabled_(browser_view_->IsRegularOrGuestSession()), |
44 is_rectangle_(false), | 44 is_rectangle_(false), |
45 old_height_(0) { | 45 old_height_(0) { |
46 // In RTL mode, the avatar icon should be looking the opposite direction. | 46 // In RTL mode, the avatar icon should be looking the opposite direction. |
47 EnableCanvasFlippingForRTLUI(true); | 47 EnableCanvasFlippingForRTLUI(true); |
48 | 48 |
49 SetEventTargeter( | 49 SetEventTargeter( |
50 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 50 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
51 } | 51 } |
52 | 52 |
53 AvatarMenuButton::~AvatarMenuButton() { | 53 AvatarMenuButton::~AvatarMenuButton() { |
54 } | 54 } |
55 | 55 |
56 const char* AvatarMenuButton::GetClassName() const { | 56 const char* AvatarMenuButton::GetClassName() const { |
57 return kViewClassName; | 57 return kViewClassName; |
58 } | 58 } |
59 | 59 |
60 void AvatarMenuButton::OnPaint(gfx::Canvas* canvas) { | 60 void AvatarMenuButton::OnPaint(gfx::Canvas* canvas) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 views::ViewTargeterDelegate::DoesIntersectRect(target, rect); | 150 views::ViewTargeterDelegate::DoesIntersectRect(target, rect); |
151 } | 151 } |
152 | 152 |
153 // views::MenuButtonListener implementation | 153 // views::MenuButtonListener implementation |
154 void AvatarMenuButton::OnMenuButtonClicked(views::MenuButton* source, | 154 void AvatarMenuButton::OnMenuButtonClicked(views::MenuButton* source, |
155 const gfx::Point& point, | 155 const gfx::Point& point, |
156 const ui::Event* event) { | 156 const ui::Event* event) { |
157 if (enabled_) | 157 if (enabled_) |
158 chrome::ShowAvatarMenu(browser_view_->browser()); | 158 chrome::ShowAvatarMenu(browser_view_->browser()); |
159 } | 159 } |
OLD | NEW |