| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AVATAR_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void DrawTaskBarDecoration(gfx::NativeWindow window, const gfx::Image* image); | 25 void DrawTaskBarDecoration(gfx::NativeWindow window, const gfx::Image* image); |
| 26 | 26 |
| 27 // AvatarMenuButton | 27 // AvatarMenuButton |
| 28 // | 28 // |
| 29 // A button used to show either the incognito avatar or the profile avatar. | 29 // A button used to show either the incognito avatar or the profile avatar. |
| 30 // The button can optionally have a menu attached to it. | 30 // The button can optionally have a menu attached to it. |
| 31 | 31 |
| 32 class AvatarMenuButton : public views::MenuButton, | 32 class AvatarMenuButton : public views::MenuButton, |
| 33 public views::MenuButtonListener { | 33 public views::MenuButtonListener { |
| 34 public: | 34 public: |
| 35 // Creates a new button. If |has_menu| is true then clicking on the button | 35 // Creates a new button. If |incognito| is true and we're not in managed mode, |
| 36 // will cause the profile menu to be displayed. | 36 // clicking on the button will cause the profile menu to be displayed. |
| 37 AvatarMenuButton(Browser* browser, bool has_menu); | 37 AvatarMenuButton(Browser* browser, bool incognito); |
| 38 | 38 |
| 39 virtual ~AvatarMenuButton(); | 39 virtual ~AvatarMenuButton(); |
| 40 | 40 |
| 41 // views::MenuButton: | 41 // views::MenuButton: |
| 42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 43 virtual bool HitTest(const gfx::Point& point) const OVERRIDE; | 43 virtual bool HitTest(const gfx::Point& point) const OVERRIDE; |
| 44 | 44 |
| 45 virtual void SetAvatarIcon(const gfx::Image& icon, | 45 virtual void SetAvatarIcon(const gfx::Image& icon, |
| 46 bool is_gaia_picture); | 46 bool is_gaia_picture); |
| 47 | 47 |
| 48 void ShowAvatarBubble(); | 48 void ShowAvatarBubble(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // views::MenuButtonListener: | 51 // views::MenuButtonListener: |
| 52 virtual void OnMenuButtonClicked(views::View* source, | 52 virtual void OnMenuButtonClicked(views::View* source, |
| 53 const gfx::Point& point) OVERRIDE; | 53 const gfx::Point& point) OVERRIDE; |
| 54 | 54 |
| 55 void ButtonClicked(); |
| 56 |
| 55 Browser* browser_; | 57 Browser* browser_; |
| 56 bool has_menu_; | 58 bool incognito_; |
| 57 scoped_ptr<ui::MenuModel> menu_model_; | 59 scoped_ptr<ui::MenuModel> menu_model_; |
| 58 | 60 |
| 59 // Use a scoped ptr because gfx::Image doesn't have a default constructor. | 61 // Use a scoped ptr because gfx::Image doesn't have a default constructor. |
| 60 scoped_ptr<gfx::Image> icon_; | 62 scoped_ptr<gfx::Image> icon_; |
| 61 SkBitmap button_icon_; | 63 SkBitmap button_icon_; |
| 62 bool is_gaia_picture_; | 64 bool is_gaia_picture_; |
| 63 int old_height_; | 65 int old_height_; |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); | 67 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ | 70 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ |
| OLD | NEW |