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

Unified Diff: ash/common/shelf/shelf_item_delegate.h

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Cleanup; fix ash_shell compile and a couple tests. Created 3 years, 9 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
Index: ash/common/shelf/shelf_item_delegate.h
diff --git a/ash/common/shelf/shelf_item_delegate.h b/ash/common/shelf/shelf_item_delegate.h
index 8ff4aed52bc2d1fac6bf9f76be34cf8c19bf2dc7..804c51f3fe69f65afc7299789edb85503a44c226 100644
--- a/ash/common/shelf/shelf_item_delegate.h
+++ b/ash/common/shelf/shelf_item_delegate.h
@@ -8,40 +8,22 @@
#include <stdint.h>
#include "ash/ash_export.h"
-#include "ash/public/cpp/shelf_application_menu_item.h"
#include "ash/public/cpp/shelf_types.h"
+#include "ash/public/interfaces/shelf.mojom.h"
#include "ui/events/event_constants.h"
namespace ash {
-// Delegate for the ShelfItem.
-class ASH_EXPORT ShelfItemDelegate {
+// An abstract delegate for shelf items; see the mojo interface definition.
+class ASH_EXPORT ShelfItemDelegate : public mojom::ShelfItemDelegate {
public:
+ using MenuItemList = std::vector<mojom::MenuItemPtr>;
+
ShelfItemDelegate();
- virtual ~ShelfItemDelegate();
-
- // Called when the user selects a shelf item. The event type and flags, the
- // relevant display id, and the source of the selection should be provided if
- // they are known to the caller; as some subclasses use these arguments.
- // Defaults: (ET_UNKNOWN, EF_NONE, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN)
- // Returns the action performed by selecting the item.
- virtual ShelfAction ItemSelected(ui::EventType event_type,
- int event_flags,
- int64_t display_id,
- ShelfLaunchSource source) = 0;
-
- // A helper to call ItemSelected with a source and default arguments.
- ShelfAction ItemSelectedBySource(ShelfLaunchSource source);
-
- // Returns any application menu items that should appear for this shelf item.
- // |event_flags| specifies the flags of the event which triggered this menu.
- virtual ShelfAppMenuItemList GetAppMenuItems(int event_flags) = 0;
-
- // Called on invocation of a shelf item's application menu command.
- virtual void ExecuteCommand(uint32_t command_id, int event_flags) = 0;
-
- // Closes all windows associated with this item.
- virtual void Close() = 0;
+ ~ShelfItemDelegate() override;
+
+ // Calls ItemSelected with |source|, default arguments, and no callback.
+ void ItemSelectedBySource(ShelfLaunchSource source);
James Cook 2017/03/09 01:09:46 Does this class exist just to provide this method?
msw 2017/03/10 06:17:56 Done.
DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698