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

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

Issue 7331017: Multi-Profiles: Add icon chooser to profiles menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug code 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
(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_H_
6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_H_
7 #pragma once
8
9 #include <map>
10 #include <utility>
11
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/base/models/menu_model.h"
15 #include "views/controls/menu/menu_delegate.h"
16
17 class Browser;
18
19 class AvatarMenu : public base::RefCounted<AvatarMenu>,
20 public views::MenuDelegate {
21 public:
22 explicit AvatarMenu(Browser* browser);
sky 2011/07/08 21:01:44 It seems like we only need Profile for this class.
sail 2011/07/08 21:53:57 Done.
23
24 void Init(ui::MenuModel* model);
25
26 // Shows the menu relative to the specified view.
27 void RunMenu(views::MenuButton* host);
28
29 virtual bool IsItemChecked(int id) const OVERRIDE;
sky 2011/07/08 21:01:44 Code for building a MenuItemView exists in MenuMod
sail 2011/07/08 21:53:57 Done.
30 virtual bool IsCommandEnabled(int id) const OVERRIDE;
31 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE;
32 virtual bool GetAccelerator(int id, views::Accelerator* accelerator) OVERRIDE;
33
34 private:
35 // Populates |parent| with all the child menus in |model|. Recursively invokes
36 // |PopulateMenu| for any submenu.
37 void PopulateMenu(views::MenuItemView* parent,
38 ui::MenuModel* model,
39 int* next_id);
40
41 // Adds a new menu to |parent| to represent the MenuModel/index pair passed
42 // in.
43 views::MenuItemView* AppendMenuItem(views::MenuItemView* parent,
44 ui::MenuModel* model,
45 int index,
46 ui::MenuModel::ItemType menu_type,
47 int* next_id);
48
49 typedef std::pair<ui::MenuModel*,int> Entry;
50 typedef std::map<int,Entry> IDToEntry;
51
52 // Maps from the ID as understood by MenuItemView to the model/index pair the
53 // item came from.
54 IDToEntry id_to_entry_;
55
56 // The views menu.
57 scoped_ptr<views::MenuItemView> root_;
58
59 // Browser the menu is being shown for.
60 Browser* browser_;
61
62 DISALLOW_COPY_AND_ASSIGN(AvatarMenu);
63 };
64
65 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698