window_watcher_shelf_item_delegate.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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/window_watcher_shelf_item_delegate.h" 6 7#include "ash/shell/window_watcher.h" 8#include "ash/wm/window_util.h" 9#include "ui/aura/window.h" 10 11namespace ash { 12namespace shell { 13 14WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate( 15 ShelfID id, 16 WindowWatcher* watcher) 17 : id_(id), watcher_(watcher) { 18 DCHECK_GT(id_, 0); 19 DCHECK(watcher_); 20} 21 22WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() { 23} 24 25bool WindowWatcherShelfItemDelegate::ItemSelected(const ui::Event& event) { 26 aura::Window* window = watcher_->GetWindowByID(id_); 27 if (window->type() == ui::wm::WINDOW_TYPE_PANEL) 28 wm::MoveWindowToEventRoot(window, event); 29 window->Show(); 30 wm::ActivateWindow(window); 31 return false; 32} 33 34base::string16 WindowWatcherShelfItemDelegate::GetTitle() { 35 return watcher_->GetWindowByID(id_)->title(); 36} 37 38ui::MenuModel* WindowWatcherShelfItemDelegate::CreateContextMenu( 39 aura::Window* root_window) { 40 return NULL; 41} 42 43ShelfMenuModel* WindowWatcherShelfItemDelegate::CreateApplicationMenu( 44 int event_flags) { 45 return NULL; 46} 47 48bool WindowWatcherShelfItemDelegate::IsDraggable() { 49 return true; 50} 51 52bool WindowWatcherShelfItemDelegate::ShouldShowTooltip() { 53 return true; 54} 55 56void WindowWatcherShelfItemDelegate::Close() { 57} 58 59} // namespace shell 60} // namespace ash 61