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" |
11 #include "ui/base/models/simple_menu_model.h" | 11 #include "ui/base/models/simple_menu_model.h" |
12 #include "ui/views/controls/button/menu_button.h" | 12 #include "ui/views/controls/button/menu_button.h" |
13 #include "ui/views/controls/button/menu_button_listener.h" | 13 #include "ui/views/controls/button/menu_button_listener.h" |
14 #include "ui/views/view_targeter_delegate.h" | 14 #include "ui/views/view_targeter_delegate.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Canvas; | 17 class Canvas; |
18 class Image; | 18 class Image; |
19 } | 19 } |
20 class Browser; | 20 class Browser; |
21 class Profile; | |
21 | 22 |
22 // AvatarMenuButton | 23 // AvatarMenuButton |
23 // | 24 // |
24 // A button used to show either the incognito avatar or the profile avatar. | 25 // A button used to show either the incognito avatar or the profile avatar. |
25 // The button can optionally have a menu attached to it. | 26 // The button can optionally have a menu attached to it. |
26 | 27 |
27 class AvatarMenuButton : public views::MenuButton, | 28 class AvatarMenuButton : public views::MenuButton, |
28 public views::MenuButtonListener, | 29 public views::MenuButtonListener, |
29 public views::ViewTargeterDelegate { | 30 public views::ViewTargeterDelegate { |
30 public: | 31 public: |
31 // Internal class name. | 32 // Internal class name. |
32 static const char kViewClassName[]; | 33 static const char kViewClassName[]; |
33 | 34 |
35 // Get avatar images for the profile. |avatar| is used in the browser window | |
36 // whereas |taskbar_badge_avatar| is used for the OS taskbar. If | |
37 // |taskbar_badge_avatar| is empty then |avatar| should be used for the | |
38 // taskbar as well. | |
39 static void GetAvatarImages(Profile* profile, | |
40 gfx::Image* avatar, | |
41 gfx::Image* taskbar_badge_avatar, | |
42 bool *is_rectangle); | |
43 | |
34 // Creates a new button. Unless |disabled| is true, clicking on the button | 44 // Creates a new button. Unless |disabled| is true, clicking on the button |
35 // will cause the profile menu to be displayed. | 45 // will cause the profile menu to be displayed. |
36 AvatarMenuButton(Browser* browser, bool disabled); | 46 AvatarMenuButton(Browser* browser, bool disabled); |
sky
2014/10/27 14:45:37
nit: style guide says constructor/destructor are b
Roger Tawa OOO till Jul 10th
2014/10/27 18:51:11
Done.
| |
37 | 47 |
38 virtual ~AvatarMenuButton(); | 48 virtual ~AvatarMenuButton(); |
39 | 49 |
40 // views::MenuButton: | 50 // views::MenuButton: |
41 virtual const char* GetClassName() const override; | 51 virtual const char* GetClassName() const override; |
42 virtual void OnPaint(gfx::Canvas* canvas) override; | 52 virtual void OnPaint(gfx::Canvas* canvas) override; |
43 | 53 |
44 // Sets the image for the avatar button. Rectangular images, as opposed | 54 // 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. | 55 // to Chrome avatar icons, will be resized and modified for the title bar. |
46 virtual void SetAvatarIcon(const gfx::Image& icon, bool is_rectangle); | 56 virtual void SetAvatarIcon(const gfx::Image& icon, bool is_rectangle); |
(...skipping 21 matching lines...) Expand all Loading... | |
68 gfx::ImageSkia button_icon_; | 78 gfx::ImageSkia button_icon_; |
69 bool is_rectangle_; | 79 bool is_rectangle_; |
70 int old_height_; | 80 int old_height_; |
71 // True if the avatar button is on the right side of the browser window. | 81 // True if the avatar button is on the right side of the browser window. |
72 bool button_on_right_; | 82 bool button_on_right_; |
73 | 83 |
74 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); | 84 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); |
75 }; | 85 }; |
76 | 86 |
77 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ | 87 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_MENU_BUTTON_H_ |
OLD | NEW |