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.
5 #include "ash/shell/window_watcher_shelf_item_delegate.h"
7 #include "ash/shell/window_watcher.h"
8 #include "ash/wm/window_util.h"
9 #include "ui/aura/window.h"
14 WindowWatcherShelfItemDelegate::WindowWatcherShelfItemDelegate(
16 WindowWatcher
* watcher
)
17 : id_(id
), watcher_(watcher
) {
22 WindowWatcherShelfItemDelegate::~WindowWatcherShelfItemDelegate() {
25 bool 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
);
30 wm::ActivateWindow(window
);
34 base::string16
WindowWatcherShelfItemDelegate::GetTitle() {
35 return watcher_
->GetWindowByID(id_
)->title();
38 ui::MenuModel
* WindowWatcherShelfItemDelegate::CreateContextMenu(
39 aura::Window
* root_window
) {
43 ShelfMenuModel
* WindowWatcherShelfItemDelegate::CreateApplicationMenu(
48 bool WindowWatcherShelfItemDelegate::IsDraggable() {
52 bool WindowWatcherShelfItemDelegate::ShouldShowTooltip() {
56 void WindowWatcherShelfItemDelegate::Close() {