| 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 "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 ShelfItemDelegate::PerformedAction WindowWatcherShelfItemDelegate::ItemSelected( | 24 ShelfAction WindowWatcherShelfItemDelegate::ItemSelected( |
| 25 const ui::Event& event) { | 25 ui::EventType event_type, |
| 26 int event_flags, |
| 27 int64_t display_id, |
| 28 ShelfLaunchSource source) { |
| 26 aura::Window* window = watcher_->GetWindowByID(id_); | 29 aura::Window* window = watcher_->GetWindowByID(id_); |
| 27 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) | 30 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) |
| 28 wm::MoveWindowToEventRoot(window, event); | 31 wm::MoveWindowToDisplay(window, display_id); |
| 29 window->Show(); | 32 window->Show(); |
| 30 wm::ActivateWindow(window); | 33 wm::ActivateWindow(window); |
| 31 return kExistingWindowActivated; | 34 return SHELF_ACTION_WINDOW_ACTIVATED; |
| 32 } | 35 } |
| 33 | 36 |
| 34 ShelfAppMenuItemList WindowWatcherShelfItemDelegate::GetAppMenuItems( | 37 ShelfAppMenuItemList WindowWatcherShelfItemDelegate::GetAppMenuItems( |
| 35 int event_flags) { | 38 int event_flags) { |
| 36 // Return an empty item list to avoid showing an application menu. | 39 // Return an empty item list to avoid showing an application menu. |
| 37 return ShelfAppMenuItemList(); | 40 return ShelfAppMenuItemList(); |
| 38 } | 41 } |
| 39 | 42 |
| 40 void WindowWatcherShelfItemDelegate::Close() {} | 43 void WindowWatcherShelfItemDelegate::Close() {} |
| 41 | 44 |
| 42 } // namespace shell | 45 } // namespace shell |
| 43 } // namespace ash | 46 } // namespace ash |
| OLD | NEW |