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

Unified Diff: ash/common/shelf/wm_shelf.cc

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Address comments. 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
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/common/test/test_shelf_item_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/wm_shelf.cc
diff --git a/ash/common/shelf/wm_shelf.cc b/ash/common/shelf/wm_shelf.cc
index 2a06cc21baa5039b55009c07e6ae45d745dd18c5..6d67c2ddab8a24a0acfb8d9e8da123d0faa6c5d1 100644
--- a/ash/common/shelf/wm_shelf.cc
+++ b/ash/common/shelf/wm_shelf.cc
@@ -6,7 +6,6 @@
#include "ash/common/shelf/shelf_controller.h"
#include "ash/common/shelf/shelf_delegate.h"
-#include "ash/common/shelf/shelf_item_delegate.h"
#include "ash/common/shelf/shelf_layout_manager.h"
#include "ash/common/shelf/shelf_locking_manager.h"
#include "ash/common/shelf/shelf_model.h"
@@ -16,6 +15,7 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "ash/public/cpp/shell_window_ids.h"
+#include "ash/public/interfaces/shelf.mojom.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf_bezel_event_handler.h"
#include "ash/shell.h"
@@ -27,6 +27,14 @@
namespace ash {
+namespace {
+
+// A callback that does nothing after shelf item selection handling.
+void NoopCallback(ShelfAction,
+ base::Optional<std::vector<mojom::MenuItemPtr>>) {}
+
+} // namespace
+
// WmShelf::AutoHideEventHandler -----------------------------------------------
// Forwards mouse and gesture events to ShelfLayoutManager for auto-hide.
@@ -291,9 +299,12 @@ void WmShelf::LaunchShelfItem(int item_index) {
void WmShelf::ActivateShelfItem(int item_index) {
ShelfModel* shelf_model = WmShell::Get()->shelf_model();
const ShelfItem& item = shelf_model->items()[item_index];
- ShelfItemDelegate* item_delegate = shelf_model->GetShelfItemDelegate(item.id);
- item_delegate->ItemSelected(ui::ET_KEY_RELEASED, ui::EF_NONE,
- display::kInvalidDisplayId, LAUNCH_FROM_UNKNOWN);
+ mojom::ShelfItemDelegate* item_delegate =
+ shelf_model->GetShelfItemDelegate(item.id);
+ std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>(
+ ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE);
+ item_delegate->ItemSelected(std::move(event), display::kInvalidDisplayId,
+ LAUNCH_FROM_UNKNOWN, base::Bind(&NoopCallback));
}
bool WmShelf::ProcessGestureEvent(const ui::GestureEvent& event) {
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_item_delegate.cc ('k') | ash/common/test/test_shelf_item_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698