Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: ash/public/cpp/shelf_application_menu_item.h

Issue 2671923002: mash: Cleanup ash shelf application menu code. (Closed)
Patch Set: Add comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/public/cpp/BUILD.gn ('k') | ash/public/cpp/shelf_application_menu_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/public/cpp/shelf_application_menu_item.h
diff --git a/ash/public/cpp/shelf_application_menu_item.h b/ash/public/cpp/shelf_application_menu_item.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2d7e5355a31fe16723c1b20bcb1d59d60c7ffc6
--- /dev/null
+++ b/ash/public/cpp/shelf_application_menu_item.h
@@ -0,0 +1,46 @@
+// Copyright 2017 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 ASH_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_
+#define ASH_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_
+
+#include <memory>
+#include <vector>
+
+#include "ash/public/cpp/ash_public_export.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "ui/gfx/image/image.h"
+
+namespace ash {
+
+// The title, icon, and execute function for shelf application menu items.
+class ASH_PUBLIC_EXPORT ShelfApplicationMenuItem {
+ public:
+ // Creates an item with a |title| and optional |icon| (pass nullptr for none).
+ explicit ShelfApplicationMenuItem(const base::string16 title,
+ const gfx::Image* icon = nullptr);
+ virtual ~ShelfApplicationMenuItem();
+
+ // The title and icon for this menu item.
+ const base::string16& title() const { return title_; }
+ const gfx::Image& icon() const { return icon_; }
+
+ // Executes the menu item; |event_flags| can be used to check additional
+ // keyboard modifiers from the event that issued this command.
+ virtual void Execute(int event_flags);
+
+ private:
+ const base::string16 title_;
+ const gfx::Image icon_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShelfApplicationMenuItem);
+};
+
+using ShelfAppMenuItemList =
+ std::vector<std::unique_ptr<ShelfApplicationMenuItem>>;
+
+} // namespace ash
+
+#endif // ASH_PUBLIC_CPP_SHELF_APPLICATION_MENU_ITEM_H_
« no previous file with comments | « ash/public/cpp/BUILD.gn ('k') | ash/public/cpp/shelf_application_menu_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698