| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "ui/base/models/simple_menu_model.h" | |
| 13 #include "views/controls/button/menu_button.h" | |
| 14 #include "views/controls/menu/view_menu_delegate.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 class Canvas; | |
| 18 } | |
| 19 | |
| 20 // AvatarMenuButton | |
| 21 // | |
| 22 // A button used to show either the incognito avatar or the profile avatar. | |
| 23 // The button can optionally have a menu attached to it. | |
| 24 | |
| 25 class AvatarMenuButton : public views::MenuButton, | |
| 26 public views::ViewMenuDelegate { | |
| 27 public: | |
| 28 // Creates a new button. The object will take ownership of the menu model. | |
| 29 AvatarMenuButton(const std::wstring& text, ui::MenuModel* menu_model); | |
| 30 | |
| 31 virtual ~AvatarMenuButton(); | |
| 32 | |
| 33 // views::MenuButton | |
| 34 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 35 | |
| 36 static gfx::Size GetPreferredAvatarSize(); | |
| 37 | |
| 38 private: | |
| 39 // views::ViewMenuDelegate | |
| 40 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | |
| 41 | |
| 42 scoped_ptr<ui::MenuModel> menu_model_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); | |
| 45 }; | |
| 46 | |
| 47 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ | |
| OLD | NEW |