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 ShelfItemDelegate::PerformedAction
WindowWatcherShelfItemDelegate::ItemSelected(
26 const ui::Event
& event
) {
27 aura::Window
* window
= watcher_
->GetWindowByID(id_
);
28 if (window
->type() == ui::wm::WINDOW_TYPE_PANEL
)
29 wm::MoveWindowToEventRoot(window
, event
);
31 wm::ActivateWindow(window
);
32 return kExistingWindowActivated
;
35 base::string16
WindowWatcherShelfItemDelegate::GetTitle() {
36 return watcher_
->GetWindowByID(id_
)->title();
39 ui::MenuModel
* WindowWatcherShelfItemDelegate::CreateContextMenu(
40 aura::Window
* root_window
) {
44 ShelfMenuModel
* WindowWatcherShelfItemDelegate::CreateApplicationMenu(
49 bool WindowWatcherShelfItemDelegate::IsDraggable() {
53 bool WindowWatcherShelfItemDelegate::ShouldShowTooltip() {
57 void WindowWatcherShelfItemDelegate::Close() {