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

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

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 #include "chrome/browser/ui/toolbar/action_box_menu_model.h"
6
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_toolbar_model.h"
9 #include "chrome/browser/extensions/extension_service.h"
10
11 static const int kFirstExtensionCommandId = 1000;
Peter Kasting 2012/07/18 01:37:25 Nit: Comment on whether and how this interacts wit
yefimt 2012/07/18 23:18:13 Done.
12
13 ////////////////////////////////////////////////////////////////////////////////
14 // ActionBoxMenuModel
15
16 ActionBoxMenuModel::ActionBoxMenuModel(ExtensionService* extension_service)
17 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
18 extension_service_(extension_service) {
19 Build();
20 }
21
22 ActionBoxMenuModel::~ActionBoxMenuModel() {
23 }
24
25 void ActionBoxMenuModel::ExecuteCommand(int command_id) {
26 }
27
28 bool ActionBoxMenuModel::IsCommandIdChecked(int command_id) const {
29 return false;
30 }
31
32 bool ActionBoxMenuModel::IsCommandIdEnabled(int command_id) const {
33 return true;
34 }
35
36 bool ActionBoxMenuModel::GetAcceleratorForCommandId(
37 int command_id,
38 ui::Accelerator* accelerator) {
39 return false;
40 }
41
42 void ActionBoxMenuModel::Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details) {
45 }
46
47 size_t ActionBoxMenuModel::action_box_extensions_size() {
48 return extension_service_->toolbar_model()->action_box_extensions_size();
49 }
50
51 const extensions::Extension*
52 ActionBoxMenuModel::GetActionBoxExtensionByIndex(int index) {
53 return extension_service_->toolbar_model()->
54 GetActionBoxExtensionByIndex(index);
55 }
56
57 void ActionBoxMenuModel::Build() {
58 int command_id = kFirstExtensionCommandId;
59 for (size_t i = 0; i < action_box_extensions_size(); ++i) {
60 const extensions::Extension* extension = GetActionBoxExtensionByIndex(i);
61 AddItem(command_id, UTF8ToUTF16(extension->name()));
62 id_to_extension_id_[command_id++] = extension->id();
63 }
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698