Chromium Code Reviews| Index: chrome/browser/ui/toolbar/action_box_menu_model.cc |
| diff --git a/chrome/browser/ui/toolbar/action_box_menu_model.cc b/chrome/browser/ui/toolbar/action_box_menu_model.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6fb33b53b2f5611d103958da725f7270cc97a2c6 |
| --- /dev/null |
| +++ b/chrome/browser/ui/toolbar/action_box_menu_model.cc |
| @@ -0,0 +1,36 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/toolbar/action_box_menu_model.h" |
| + |
| +#include "base/utf_string_conversions.h" |
| +#include "chrome/browser/extensions/extension_toolbar_model.h" |
| + |
| +// Arbitrary number just to leave enough space for menu IDs |
| +// that show before extensions. Like "Bookmark this page", "Send tab to device" |
| +// and so on. They could have any IDs < kFirstExtensionCommandId. |
| +static const int kFirstExtensionCommandId = 1000; |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// ActionBoxMenuModel |
| + |
| +ActionBoxMenuModel::ActionBoxMenuModel(ExtensionService* extension_service) |
| + : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(NULL)), |
| + extension_service_(extension_service) { |
| + // Adds extensions to the model. |
| + int command_id = kFirstExtensionCommandId; |
| + for (size_t i = 0; i < action_box_extensions_size(); ++i) { |
|
Peter Kasting
2012/08/03 23:17:42
Nit: If the extension toolbar model provides an ac
yefimt
2012/08/07 00:47:06
I kind of did it, but I think ActionBoxMenuModel s
|
| + const extensions::Extension* extension = GetActionBoxExtensionByIndex(i); |
| + AddItem(command_id, UTF8ToUTF16(extension->name())); |
| + id_to_extension_id_map_[command_id++] = extension->id(); |
| + } |
| +} |
| + |
| +ActionBoxMenuModel::~ActionBoxMenuModel() { |
| +} |
| + |
| +void ActionBoxMenuModel::Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) { |
| +} |