| 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_launcher_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 WindowWatcherLauncherItemDelegate::WindowWatcherLauncherItemDelegate( | 14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate( |
| 15 ash::LauncherID id, | 15 LauncherID id, |
| 16 ash::shell::WindowWatcher* watcher) | 16 WindowWatcher* watcher) |
| 17 : id_(id), | 17 : id_(id), watcher_(watcher) { |
| 18 watcher_(watcher) { | |
| 19 DCHECK_GT(id_, 0); | 18 DCHECK_GT(id_, 0); |
| 20 DCHECK(watcher_); | 19 DCHECK(watcher_); |
| 21 } | 20 } |
| 22 | 21 |
| 23 WindowWatcherLauncherItemDelegate::~WindowWatcherLauncherItemDelegate() { | 22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() { |
| 24 } | 23 } |
| 25 | 24 |
| 26 bool WindowWatcherLauncherItemDelegate::ItemSelected(const ui::Event& event) { | 25 bool WindowWatcherShelfItemDelegate::ItemSelected(const ui::Event& event) { |
| 27 aura::Window* window = watcher_->GetWindowByID(id_); | 26 aura::Window* window = watcher_->GetWindowByID(id_); |
| 28 if (window->type() == aura::client::WINDOW_TYPE_PANEL) | 27 if (window->type() == aura::client::WINDOW_TYPE_PANEL) |
| 29 ash::wm::MoveWindowToEventRoot(window, event); | 28 wm::MoveWindowToEventRoot(window, event); |
| 30 window->Show(); | 29 window->Show(); |
| 31 ash::wm::ActivateWindow(window); | 30 wm::ActivateWindow(window); |
| 32 return false; | 31 return false; |
| 33 } | 32 } |
| 34 | 33 |
| 35 base::string16 WindowWatcherLauncherItemDelegate::GetTitle() { | 34 base::string16 WindowWatcherShelfItemDelegate::GetTitle() { |
| 36 return watcher_->GetWindowByID(id_)->title(); | 35 return watcher_->GetWindowByID(id_)->title(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 ui::MenuModel* WindowWatcherLauncherItemDelegate::CreateContextMenu( | 38 ui::MenuModel* WindowWatcherShelfItemDelegate::CreateContextMenu( |
| 40 aura::Window* root_window) { | 39 aura::Window* root_window) { |
| 41 return NULL; | 40 return NULL; |
| 42 } | 41 } |
| 43 | 42 |
| 44 ash::LauncherMenuModel* | 43 LauncherMenuModel* WindowWatcherShelfItemDelegate::CreateApplicationMenu( |
| 45 WindowWatcherLauncherItemDelegate::CreateApplicationMenu( | |
| 46 int event_flags) { | 44 int event_flags) { |
| 47 return NULL; | 45 return NULL; |
| 48 } | 46 } |
| 49 | 47 |
| 50 bool WindowWatcherLauncherItemDelegate::IsDraggable() { | 48 bool WindowWatcherShelfItemDelegate::IsDraggable() { |
| 51 return true; | 49 return true; |
| 52 } | 50 } |
| 53 | 51 |
| 54 bool WindowWatcherLauncherItemDelegate::ShouldShowTooltip() { | 52 bool WindowWatcherShelfItemDelegate::ShouldShowTooltip() { |
| 55 return true; | 53 return true; |
| 56 } | 54 } |
| 57 | 55 |
| 58 } // namespace shell | 56 } // namespace shell |
| 59 } // namespace ash | 57 } // namespace ash |
| OLD | NEW |