| 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 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Internal class name. | 31 // Internal class name. |
| 32 static const char kViewClassName[]; | 32 static const char kViewClassName[]; |
| 33 | 33 |
| 34 // Creates a new button. Unless |disabled| is true, clicking on the button | 34 // Creates a new button. Unless |disabled| is true, clicking on the button |
| 35 // will cause the profile menu to be displayed. | 35 // will cause the profile menu to be displayed. |
| 36 AvatarMenuButton(Browser* browser, bool disabled); | 36 AvatarMenuButton(Browser* browser, bool disabled); |
| 37 | 37 |
| 38 virtual ~AvatarMenuButton(); | 38 virtual ~AvatarMenuButton(); |
| 39 | 39 |
| 40 // views::MenuButton: | 40 // views::MenuButton: |
| 41 virtual const char* GetClassName() const OVERRIDE; | 41 virtual const char* GetClassName() const override; |
| 42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 42 virtual void OnPaint(gfx::Canvas* canvas) override; |
| 43 | 43 |
| 44 // Sets the image for the avatar button. Rectangular images, as opposed | 44 // Sets the image for the avatar button. Rectangular images, as opposed |
| 45 // to Chrome avatar icons, will be resized and modified for the title bar. | 45 // to Chrome avatar icons, will be resized and modified for the title bar. |
| 46 virtual void SetAvatarIcon(const gfx::Image& icon, bool is_rectangle); | 46 virtual void SetAvatarIcon(const gfx::Image& icon, bool is_rectangle); |
| 47 | 47 |
| 48 void set_button_on_right(bool button_on_right) { | 48 void set_button_on_right(bool button_on_right) { |
| 49 button_on_right_ = button_on_right; | 49 button_on_right_ = button_on_right; |
| 50 } | 50 } |
| 51 bool button_on_right() { return button_on_right_; } | 51 bool button_on_right() { return button_on_right_; } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // views::ViewTargeterDelegate: | 54 // views::ViewTargeterDelegate: |
| 55 virtual bool DoesIntersectRect(const views::View* target, | 55 virtual bool DoesIntersectRect(const views::View* target, |
| 56 const gfx::Rect& rect) const OVERRIDE; | 56 const gfx::Rect& rect) const override; |
| 57 | 57 |
| 58 // views::MenuButtonListener: | 58 // views::MenuButtonListener: |
| 59 virtual void OnMenuButtonClicked(views::View* source, | 59 virtual void OnMenuButtonClicked(views::View* source, |
| 60 const gfx::Point& point) OVERRIDE; | 60 const gfx::Point& point) override; |
| 61 | 61 |
| 62 Browser* browser_; | 62 Browser* browser_; |
| 63 bool disabled_; | 63 bool disabled_; |
| 64 scoped_ptr<ui::MenuModel> menu_model_; | 64 scoped_ptr<ui::MenuModel> menu_model_; |
| 65 | 65 |
| 66 // Use a scoped ptr because gfx::Image doesn't have a default constructor. | 66 // Use a scoped ptr because gfx::Image doesn't have a default constructor. |
| 67 scoped_ptr<gfx::Image> icon_; | 67 scoped_ptr<gfx::Image> icon_; |
| 68 gfx::ImageSkia button_icon_; | 68 gfx::ImageSkia button_icon_; |
| 69 bool is_rectangle_; | 69 bool is_rectangle_; |
| 70 int old_height_; | 70 int old_height_; |
| 71 // True if the avatar button is on the right side of the browser window. | 71 // True if the avatar button is on the right side of the browser window. |
| 72 bool button_on_right_; | 72 bool button_on_right_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); | 74 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ | 77 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ |
| OLD | NEW |