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

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 // Arbitrary number just to leave enough space for menu ids
12 // that show before extensions.
Peter Kasting 2012/07/26 20:37:17 Nit: Thanks for adding this comment. Could you sa
yefimt 2012/07/31 00:10:11 Done.
13 static const int kFirstExtensionCommandId = 1000;
14
15 ////////////////////////////////////////////////////////////////////////////////
16 // ActionBoxMenuModel
17
18 ActionBoxMenuModel::ActionBoxMenuModel(ExtensionService* extension_service)
19 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)),
20 extension_service_(extension_service) {
21 // Adds extensions to the model.
22 int command_id = kFirstExtensionCommandId;
23 for (size_t i = 0; i < action_box_extensions_size(); ++i) {
24 const extensions::Extension* extension = GetActionBoxExtensionByIndex(i);
25 AddItem(command_id, UTF8ToUTF16(extension->name()));
26 id_to_extension_id_[command_id++] = extension->id();
27 }
28 }
29
30 ActionBoxMenuModel::~ActionBoxMenuModel() {
31 }
32
33 size_t ActionBoxMenuModel::action_box_extensions_size() {
34 return extension_service_->toolbar_model()->action_box_extensions_size();
35 }
36
37 const extensions::Extension*
38 ActionBoxMenuModel::GetActionBoxExtensionByIndex(int index) {
39 return extension_service_->toolbar_model()->
40 action_box_menu_item_by_index(index);
41 }
42
43 bool ActionBoxMenuModel::IsCommandIdChecked(int command_id) const {
44 return false;
45 }
46
47 bool ActionBoxMenuModel::IsCommandIdEnabled(int command_id) const {
48 return true;
49 }
50
51 bool ActionBoxMenuModel::GetAcceleratorForCommandId(
52 int command_id,
53 ui::Accelerator* accelerator) {
54 return false;
55 }
56
57 void ActionBoxMenuModel::ExecuteCommand(int command_id) {
58 }
59
60 void ActionBoxMenuModel::Observe(int type,
61 const content::NotificationSource& source,
62 const content::NotificationDetails& details) {
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698