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

Side by Side Diff: chrome/browser/ui/toolbar/action_box_menu_model.h

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 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) 2012 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_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
7
8 #include <map>
9
10 #include "base/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "ui/base/models/button_menu_item_model.h"
14 #include "ui/base/models/simple_menu_model.h"
15
16 class ExtensionService;
17
18 namespace extensions {
19 class Extension;
20 }
21
22
23 // A menu model that builds the contents of the action box menu.
24 class ActionBoxMenuModel : public ui::SimpleMenuModel,
25 public ui::SimpleMenuModel::Delegate,
26 public content::NotificationObserver {
27 public:
28 explicit ActionBoxMenuModel(ExtensionService* extension_service);
29 virtual ~ActionBoxMenuModel();
30
31 // Active box extensions.
32 size_t action_box_extensions_size();
33 const extensions::Extension* GetActionBoxExtensionByIndex(int index);
34
35 private:
36 typedef std::map<int, std::string> IdToEntensionIdMap;
37
38 // Overridden for both SimpleMenuModel::Delegate and SimpleMenuModel.
39 virtual void ExecuteCommand(int command_id) OVERRIDE;
40 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
41 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
42 virtual bool GetAcceleratorForCommandId(
43 int command_id,
44 ui::Accelerator* accelerator) OVERRIDE;
45
46 // Overridden from content::NotificationObserver:
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
51 // Adds extensions to the model.
52 void Build();
53
54 ExtensionService* extension_service_;
55
56 IdToEntensionIdMap id_to_extension_id_;
57
58 DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel);
59 };
60
61 #endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698