Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/ui/views/avatar_menu_button.h

Issue 8500004: Rebase AvatarMenuBubbleView on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused var and fix init order (nits). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/browser/ui/views/bubble/bubble.h"
13 #include "ui/base/models/simple_menu_model.h" 12 #include "ui/base/models/simple_menu_model.h"
14 #include "views/controls/button/menu_button.h" 13 #include "views/controls/button/menu_button.h"
15 #include "views/controls/menu/view_menu_delegate.h" 14 #include "views/controls/menu/view_menu_delegate.h"
16 15
17 namespace gfx { 16 namespace gfx {
18 class Canvas; 17 class Canvas;
19 } 18 }
20 class Browser; 19 class Browser;
21 20
22 // AvatarMenuButton 21 // AvatarMenuButton
23 // 22 //
24 // A button used to show either the incognito avatar or the profile avatar. 23 // A button used to show either the incognito avatar or the profile avatar.
25 // The button can optionally have a menu attached to it. 24 // The button can optionally have a menu attached to it.
26 25
27 class AvatarMenuButton : public views::MenuButton, 26 class AvatarMenuButton : public views::MenuButton,
28 public views::ViewMenuDelegate, 27 public views::ViewMenuDelegate {
29 public Bubble::Observer {
30 public: 28 public:
31 // Creates a new button. If |has_menu| is true then clicking on the button 29 // Creates a new button. If |has_menu| is true then clicking on the button
32 // will cause the profile menu to be displayed. 30 // will cause the profile menu to be displayed.
33 AvatarMenuButton(Browser* browser, bool has_menu); 31 AvatarMenuButton(Browser* browser, bool has_menu);
34 32
35 virtual ~AvatarMenuButton(); 33 virtual ~AvatarMenuButton();
36 34
37 // views::MenuButton 35 // views::MenuButton
38 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 36 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
39 virtual bool HitTest(const gfx::Point& point) const OVERRIDE; 37 virtual bool HitTest(const gfx::Point& point) const OVERRIDE;
40 38
41 // views::TextButton 39 // views::TextButton
42 virtual void SetIcon(const SkBitmap& icon) OVERRIDE; 40 virtual void SetIcon(const SkBitmap& icon) OVERRIDE;
43 41
44 void ShowAvatarBubble(); 42 void ShowAvatarBubble();
45 43
46 private: 44 private:
47 // views::ViewMenuDelegate 45 // views::ViewMenuDelegate
48 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; 46 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
49 47
50 // Bubble::Observer implementation.
51 virtual void OnBubbleClosing();
52
53 Browser* browser_; 48 Browser* browser_;
54 Bubble* bubble_;
55 bool has_menu_; 49 bool has_menu_;
56 bool set_taskbar_decoration_; 50 bool set_taskbar_decoration_;
57 scoped_ptr<ui::MenuModel> menu_model_; 51 scoped_ptr<ui::MenuModel> menu_model_;
58 52
59 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); 53 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton);
60 }; 54 };
61 55
62 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ 56 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.cc ('k') | chrome/browser/ui/views/avatar_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698