OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/shell/launcher_item_delegate_impl.h" |
| 6 |
| 7 #include "ash/shell/window_watcher.h" |
| 8 #include "ash/wm/window_util.h" |
| 9 #include "ui/aura/window.h" |
| 10 |
| 11 namespace ash { |
| 12 namespace shell { |
| 13 |
| 14 LauncherItemDelegateImpl::LauncherItemDelegateImpl( |
| 15 ash::LauncherID id, |
| 16 ash::shell::WindowWatcher* watcher) |
| 17 : id_(id), |
| 18 watcher_(watcher) { |
| 19 DCHECK(watcher_); |
| 20 } |
| 21 |
| 22 LauncherItemDelegateImpl::~LauncherItemDelegateImpl() { |
| 23 } |
| 24 |
| 25 void LauncherItemDelegateImpl::ItemSelected(const ui::Event& event) { |
| 26 aura::Window* window = watcher_->GetWindowByID(id_); |
| 27 if (window->type() == aura::client::WINDOW_TYPE_PANEL) |
| 28 ash::wm::MoveWindowToEventRoot(window, event); |
| 29 window->Show(); |
| 30 ash::wm::ActivateWindow(window); |
| 31 } |
| 32 |
| 33 base::string16 LauncherItemDelegateImpl::GetTitle() { |
| 34 return watcher_->GetWindowByID(id_)->title(); |
| 35 } |
| 36 |
| 37 ui::MenuModel* LauncherItemDelegateImpl::CreateContextMenu( |
| 38 aura::RootWindow* root_window) { |
| 39 return NULL; |
| 40 } |
| 41 |
| 42 ash::LauncherMenuModel* LauncherItemDelegateImpl::CreateApplicationMenu( |
| 43 int event_flags) { |
| 44 return NULL; |
| 45 } |
| 46 |
| 47 bool LauncherItemDelegateImpl::IsDraggable() { |
| 48 return true; |
| 49 } |
| 50 |
| 51 bool LauncherItemDelegateImpl::ShouldShowTooltip() { |
| 52 return true; |
| 53 } |
| 54 |
| 55 } // namespace shell |
| 56 } // namespace ash |
OLD | NEW |