OLD | NEW |
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 <utility> |
| 8 |
7 #include "ash/shell/window_watcher.h" | 9 #include "ash/shell/window_watcher.h" |
8 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
9 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
10 | 12 |
11 namespace ash { | 13 namespace ash { |
12 namespace shell { | 14 namespace shell { |
13 | 15 |
14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate( | 16 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate( |
15 ShelfID id, | 17 ShelfID id, |
16 WindowWatcher* watcher) | 18 WindowWatcher* watcher) |
17 : ShelfItemDelegate(id), watcher_(watcher) { | 19 : ShelfItemDelegate(id), watcher_(watcher) { |
18 DCHECK(!id.IsNull()); | 20 DCHECK(!id.IsNull()); |
19 DCHECK(watcher_); | 21 DCHECK(watcher_); |
20 } | 22 } |
21 | 23 |
22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {} | 24 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {} |
23 | 25 |
24 void WindowWatcherShelfItemDelegate::ItemSelected( | 26 void WindowWatcherShelfItemDelegate::ItemSelected( |
25 std::unique_ptr<ui::Event> event, | 27 std::unique_ptr<ui::Event> event, |
26 int64_t display_id, | 28 int64_t display_id, |
27 ShelfLaunchSource source, | 29 ShelfLaunchSource source, |
28 const ItemSelectedCallback& callback) { | 30 ItemSelectedCallback callback) { |
29 aura::Window* window = watcher_->GetWindowByID(shelf_id()); | 31 aura::Window* window = watcher_->GetWindowByID(shelf_id()); |
30 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) | 32 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) |
31 wm::MoveWindowToDisplay(window, display_id); | 33 wm::MoveWindowToDisplay(window, display_id); |
32 window->Show(); | 34 window->Show(); |
33 wm::ActivateWindow(window); | 35 wm::ActivateWindow(window); |
34 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); | 36 std::move(callback).Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); |
35 } | 37 } |
36 | 38 |
37 void WindowWatcherShelfItemDelegate::ExecuteCommand(uint32_t command_id, | 39 void WindowWatcherShelfItemDelegate::ExecuteCommand(uint32_t command_id, |
38 int32_t event_flags) { | 40 int32_t event_flags) { |
39 // This delegate does not support showing an application menu. | 41 // This delegate does not support showing an application menu. |
40 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
41 } | 43 } |
42 | 44 |
43 void WindowWatcherShelfItemDelegate::Close() {} | 45 void WindowWatcherShelfItemDelegate::Close() {} |
44 | 46 |
45 } // namespace shell | 47 } // namespace shell |
46 } // namespace ash | 48 } // namespace ash |
OLD | NEW |