Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| 10 // Arbitrary number just to leave enough space for menu IDs | |
| 11 // that show before extensions. Like "Bookmark this page", "Send tab to device" | |
| 12 // and so on. They could have any IDs < kFirstExtensionCommandId. | |
| 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(NULL)), | |
| 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) { | |
|
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
| |
| 24 const extensions::Extension* extension = GetActionBoxExtensionByIndex(i); | |
| 25 AddItem(command_id, UTF8ToUTF16(extension->name())); | |
| 26 id_to_extension_id_map_[command_id++] = extension->id(); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 ActionBoxMenuModel::~ActionBoxMenuModel() { | |
| 31 } | |
| 32 | |
| 33 void ActionBoxMenuModel::Observe(int type, | |
| 34 const content::NotificationSource& source, | |
| 35 const content::NotificationDetails& details) { | |
| 36 } | |
| OLD | NEW |