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

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

Issue 7331017: Multi-Profiles: Add icon chooser to profiles menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: close menu on button pressed Created 9 years, 5 months 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 "ui/base/models/simple_menu_model.h" 12 #include "ui/base/models/simple_menu_model.h"
13 #include "views/controls/button/menu_button.h" 13 #include "views/controls/button/menu_button.h"
14 #include "views/controls/menu/view_menu_delegate.h" 14 #include "views/controls/menu/view_menu_delegate.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class Canvas; 17 class Canvas;
18 } 18 }
19 class Browser;
19 20
20 // AvatarMenuButton 21 // AvatarMenuButton
21 // 22 //
22 // 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.
23 // The button can optionally have a menu attached to it. 24 // The button can optionally have a menu attached to it.
24 25
25 class AvatarMenuButton : public views::MenuButton, 26 class AvatarMenuButton : public views::MenuButton,
26 public views::ViewMenuDelegate { 27 public views::ViewMenuDelegate {
27 public: 28 public:
28 // Creates a new button. The object will take ownership of the menu model. 29 // Creates a new button.
29 AvatarMenuButton(const std::wstring& text, ui::MenuModel* menu_model); 30 AvatarMenuButton(Browser* browser, bool has_menu);
sky 2011/07/08 23:03:35 Document has_menu. And make this take a Profile in
sail 2011/07/08 23:07:55 Added documentation. I still need the browser para
30 31
31 virtual ~AvatarMenuButton(); 32 virtual ~AvatarMenuButton();
32 33
33 // views::MenuButton 34 // views::MenuButton
34 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 35 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
36 virtual bool HitTest(const gfx::Point& point) const OVERRIDE;
35 37
36 private: 38 private:
37 // views::ViewMenuDelegate 39 // views::ViewMenuDelegate
38 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; 40 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
39 41
42 Browser* browser_;
43 bool has_menu_;
40 scoped_ptr<ui::MenuModel> menu_model_; 44 scoped_ptr<ui::MenuModel> menu_model_;
41 45
42 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton); 46 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton);
43 }; 47 };
44 48
45 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_ 49 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698