Chromium Code Reviews| Index: chrome/browser/ui/toolbar/action_box_menu_model.h |
| diff --git a/chrome/browser/ui/toolbar/action_box_menu_model.h b/chrome/browser/ui/toolbar/action_box_menu_model.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf9c0dce73b5a89af987cbeea776a6fb5794e126 |
| --- /dev/null |
| +++ b/chrome/browser/ui/toolbar/action_box_menu_model.h |
| @@ -0,0 +1,48 @@ |
| +// 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. |
| + |
| +#ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
| +#define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |
| + |
| +#include <map> |
| + |
| +#include "content/public/browser/notification_observer.h" |
| +#include "chrome/browser/extensions/extension_service.h" |
| +#include "ui/base/models/simple_menu_model.h" |
| + |
| +namespace extensions { |
| +class Extension; |
| +} |
| + |
| +// A menu model that builds the contents of the action box menu. |
| +class ActionBoxMenuModel : public ui::SimpleMenuModel, |
| + public content::NotificationObserver { |
| + public: |
| + explicit ActionBoxMenuModel(ExtensionService* extension_service); |
| + virtual ~ActionBoxMenuModel(); |
| + |
| + size_t action_box_extensions_size() { |
|
Peter Kasting
2012/08/03 23:17:42
Nit: These can both be eliminated, see comments in
yefimt
2012/08/07 00:47:06
Done.
|
| + return extension_service_->toolbar_model()->action_box_extensions_size(); |
| + } |
| + const extensions::Extension* GetActionBoxExtensionByIndex(int index) { |
| + return extension_service_->toolbar_model()-> |
| + action_box_menu_item_by_index(index); |
| + } |
| + |
| + private: |
| + typedef std::map<int, std::string> IdToEntensionIdMap; |
| + |
| + // Overridden from content::NotificationObserver: |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + ExtensionService* extension_service_; |
|
Peter Kasting
2012/08/03 23:17:42
Nit: This can be eliminated.
yefimt
2012/08/07 00:47:06
I still need to get to toolbar model, so I use ext
|
| + |
| + IdToEntensionIdMap id_to_extension_id_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |