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..26bf38539a88943a1f6be436c20ad1d1ea690feb |
| --- /dev/null |
| +++ b/chrome/browser/ui/toolbar/action_box_menu_model.h |
| @@ -0,0 +1,61 @@ |
| +// 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 "base/file_path.h" |
|
msw
2012/07/24 23:41:55
nit: is this include necessary?
yefimt
2012/07/25 21:09:21
Done.
|
| +#include "base/memory/scoped_ptr.h" |
|
msw
2012/07/24 23:41:55
nit: is this include necessary?
yefimt
2012/07/25 21:09:21
Done.
|
| +#include "content/public/browser/notification_observer.h" |
| +#include "ui/base/models/button_menu_item_model.h" |
|
msw
2012/07/24 23:41:55
nit: is this include necessary?
yefimt
2012/07/25 21:09:21
Done.
|
| +#include "ui/base/models/simple_menu_model.h" |
| + |
| +class ExtensionService; |
| + |
| +namespace extensions { |
| +class Extension; |
| +} |
| + |
| + |
|
msw
2012/07/24 23:41:55
nit: remove extra blank line.
yefimt
2012/07/25 21:09:21
Done.
|
| +// 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(); |
| + |
| + // Active box extensions. |
|
msw
2012/07/24 23:41:55
nit: "Action" not "Active"? Capitalize "Box"? Remo
yefimt
2012/07/25 21:09:21
Done.
|
| + size_t action_box_extensions_size(); |
| + const extensions::Extension* GetActionBoxExtensionByIndex(int index); |
| + |
| + private: |
| + typedef std::map<int, std::string> IdToEntensionIdMap; |
| + |
| + // Overridden for both SimpleMenuModel::Delegate and SimpleMenuModel. |
|
msw
2012/07/24 23:41:55
nit: These are all actually from SimpleMenuModel::
yefimt
2012/07/25 21:09:21
Done.
|
| + virtual void ExecuteCommand(int command_id) OVERRIDE; |
|
msw
2012/07/24 23:41:55
nit: Match OVERRIDE declaration order and visibili
yefimt
2012/07/25 21:09:21
Done - for order
As for visibility, aa@ asked me t
msw
2012/07/25 23:02:03
OK, there's no official style guide rule, so I won
Peter Kasting
2012/07/26 02:32:27
(FWIW, I didn't say anything on this patch to my k
|
| + virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| + virtual bool IsCommandIdEnabled(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; |
| + |
| + // Adds extensions to the model. |
| + void Build(); |
|
msw
2012/07/24 23:41:55
nit: name standard |Init|? Or inline in ctor?
yefimt
2012/07/25 21:09:21
Moved
|
| + |
| + ExtensionService* extension_service_; |
| + |
| + IdToEntensionIdMap id_to_extension_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_ |