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..6ee24efe0a985a02ef7414a607e9b3453bbc85ff |
| --- /dev/null |
| +++ b/chrome/browser/ui/toolbar/action_box_menu_model.h |
| @@ -0,0 +1,59 @@ |
| +// 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_ |
| +#pragma once |
| + |
| +#include <map> |
| +#include "base/file_path.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "ui/base/models/button_menu_item_model.h" |
| +#include "ui/base/models/simple_menu_model.h" |
| + |
| +class ExtensionService; |
| + |
| +namespace extensions { |
| +class Extension; |
| +} |
| + |
| + |
| +// A menu model that builds the contents of the action box menu. |
| +class ActionBoxMenuModel : public ui::SimpleMenuModel, |
| + public ui::SimpleMenuModel::Delegate, |
| + public content::NotificationObserver { |
| + public: |
| + explicit ActionBoxMenuModel(ExtensionService* extension_service); |
| + virtual ~ActionBoxMenuModel(); |
| + |
| + // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel: |
|
Aaron Boodman
2012/06/12 05:53:44
If these aren't going to be called except through
yefimt
2012/06/13 01:24:21
Done.
|
| + virtual void ExecuteCommand(int command_id) OVERRIDE; |
| + virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| + virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| + virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; |
| + virtual bool GetAcceleratorForCommandId( |
| + int command_id, ui::Accelerator* accelerator) OVERRIDE; |
| + |
| + // Overridden from content::NotificationObserver: |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + // Active box extensions. |
| + size_t action_box_extensions_size(); |
|
Aaron Boodman
2012/06/12 05:53:44
This helper doesn't seem necessary. Can just get t
yefimt
2012/06/13 01:24:21
Internally in this class everything coming from ex
|
| + const extensions::Extension* GetActionBoxExtensionByIndex(int index); |
| + |
| + private: |
| + void Build(); |
| + |
| + ExtensionService* extension_service_; |
| + |
| + typedef std::map<int, std::string> IdToEntensionId; |
| + IdToEntensionId id_to_extension_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |