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

Side by Side Diff: ash/shell/window_watcher_shelf_item_delegate.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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shell/window_watcher_shelf_item_delegate.h" 5 #include "ash/shell/window_watcher_shelf_item_delegate.h"
6 6
7 #include "ash/shell/window_watcher.h" 7 #include "ash/shell/window_watcher.h"
8 #include "ash/wm/window_util.h" 8 #include "ash/wm/window_util.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 10
11 namespace ash { 11 namespace ash {
12 namespace shell { 12 namespace shell {
13 13
14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate( 14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate(
15 ShelfID id, 15 ShelfID id,
16 WindowWatcher* watcher) 16 WindowWatcher* watcher)
17 : id_(id), watcher_(watcher) { 17 : id_(id), watcher_(watcher) {
18 DCHECK_GT(id_, 0); 18 DCHECK_GT(id_, 0);
19 DCHECK(watcher_); 19 DCHECK(watcher_);
20 } 20 }
21 21
22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {} 22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {}
23 23
24 ShelfAction WindowWatcherShelfItemDelegate::ItemSelected( 24 void WindowWatcherShelfItemDelegate::ItemSelected(
25 ui::EventType event_type, 25 std::unique_ptr<ui::Event> event,
26 int event_flags,
27 int64_t display_id, 26 int64_t display_id,
28 ShelfLaunchSource source) { 27 ShelfLaunchSource source,
28 const ItemSelectedCallback& callback) {
29 aura::Window* window = watcher_->GetWindowByID(id_); 29 aura::Window* window = watcher_->GetWindowByID(id_);
30 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) 30 if (window->type() == ui::wm::WINDOW_TYPE_PANEL)
31 wm::MoveWindowToDisplay(window, display_id); 31 wm::MoveWindowToDisplay(window, display_id);
32 window->Show(); 32 window->Show();
33 wm::ActivateWindow(window); 33 wm::ActivateWindow(window);
34 return SHELF_ACTION_WINDOW_ACTIVATED; 34 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt);
35 }
36
37 ShelfAppMenuItemList WindowWatcherShelfItemDelegate::GetAppMenuItems(
38 int event_flags) {
39 // Return an empty item list to avoid showing an application menu.
40 return ShelfAppMenuItemList();
41 } 35 }
42 36
43 void WindowWatcherShelfItemDelegate::ExecuteCommand(uint32_t command_id, 37 void WindowWatcherShelfItemDelegate::ExecuteCommand(uint32_t command_id,
44 int event_flags) { 38 int32_t event_flags) {
45 // This delegate does not support showing an application menu. 39 // This delegate does not support showing an application menu.
46 NOTIMPLEMENTED(); 40 NOTIMPLEMENTED();
47 } 41 }
48 42
49 void WindowWatcherShelfItemDelegate::Close() {} 43 void WindowWatcherShelfItemDelegate::Close() {}
50 44
51 } // namespace shell 45 } // namespace shell
52 } // namespace ash 46 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/window_watcher_shelf_item_delegate.h ('k') | chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698