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_BUBBLE_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "chrome/browser/profiles/avatar_menu_model_observer.h" | |
12 #include "chrome/browser/ui/views/bubble/bubble.h" | |
13 #include "views/controls/button/custom_button.h" | |
14 #include "views/controls/link.h" | |
15 #include "views/controls/link_listener.h" | |
16 | |
17 class AvatarMenuModel; | |
18 class Browser; | |
19 class EditProfileButton; | |
20 | |
21 // This bubble view is displayed when the user clicks on the avatar button. | |
22 // It displays a list of profiles and allows users to switch between profiles. | |
23 class AvatarMenuBubbleView : public views::View, | |
24 public views::ButtonListener, | |
25 public views::LinkListener, | |
26 public BubbleDelegate, | |
27 public AvatarMenuModelObserver { | |
28 public: | |
29 explicit AvatarMenuBubbleView(Browser* browser); | |
30 ~AvatarMenuBubbleView(); | |
31 | |
32 // views::View implementation. | |
33 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
34 virtual void Layout() OVERRIDE; | |
35 | |
36 // views::ButtonListener implementation. | |
37 virtual void ButtonPressed(views::Button* sender, | |
38 const views::Event& event) OVERRIDE; | |
39 | |
40 // views::LinkListener implementation. | |
41 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | |
42 | |
43 // BubbleDelegate implementation. | |
44 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; | |
45 virtual bool CloseOnEscape() OVERRIDE; | |
46 virtual bool FadeInOnShow() OVERRIDE; | |
47 | |
48 // AvatarMenuModelObserver implementation. | |
49 virtual void OnAvatarMenuModelChanged( | |
50 AvatarMenuModel* avatar_menu_model) OVERRIDE; | |
51 | |
52 private: | |
53 views::Link* add_profile_link_; | |
54 scoped_ptr<AvatarMenuModel> avatar_menu_model_; | |
55 Browser* browser_; | |
56 EditProfileButton* edit_profile_button_; | |
57 std::vector<views::CustomButton*> item_views_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(AvatarMenuBubbleView); | |
60 }; | |
61 | |
62 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_ | |
OLD | NEW |