cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ash / shelf / shelf_window_watcher_item_delegate.cc
blob172b6d17785f2913eb112fca4784170660251c8c
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/shelf/shelf_window_watcher_item_delegate.h"
7 #include "ash/shelf/shelf_model.h"
8 #include "ash/shelf/shelf_util.h"
9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h"
11 #include "ash/wm/window_state.h"
12 #include "ui/aura/window.h"
13 #include "ui/views/widget/widget.h"
14 #include "ui/wm/core/window_animations.h"
16 namespace ash {
18 ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate(
19 aura::Window* window, ShelfModel* model)
20 : window_(window),
21 model_(model) {
24 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {
27 void ShelfWindowWatcherItemDelegate::Close() {
28 views::Widget::GetWidgetForNativeWindow(window_)->Close();
31 ShelfItemDelegate::PerformedAction ShelfWindowWatcherItemDelegate::ItemSelected(
32 const ui::Event& event) {
33 wm::WindowState* window_state = wm::GetWindowState(window_);
34 if (window_state->IsActive()) {
35 if (event.type() & ui::ET_KEY_RELEASED) {
36 ::wm::AnimateWindow(window_, ::wm::WINDOW_ANIMATION_TYPE_BOUNCE);
37 return kNoAction;
38 } else {
39 window_state->Minimize();
40 return kExistingWindowMinimized;
42 } else {
43 window_state->Activate();
44 return kExistingWindowActivated;
48 base::string16 ShelfWindowWatcherItemDelegate::GetTitle() {
49 return GetShelfItemDetailsForWindow(window_)->title;
52 ui::MenuModel* ShelfWindowWatcherItemDelegate::CreateContextMenu(
53 aura::Window* root_window) {
54 ash::ShelfItem item = *(model_->ItemByID(GetShelfIDForWindow(window_)));
55 return Shell::GetInstance()->delegate()->CreateContextMenu(root_window,
56 this,
57 &item);
60 ShelfMenuModel* ShelfWindowWatcherItemDelegate::CreateApplicationMenu(
61 int event_flags) {
62 return NULL;
65 bool ShelfWindowWatcherItemDelegate::IsDraggable() {
66 return true;
69 bool ShelfWindowWatcherItemDelegate::ShouldShowTooltip() {
70 return true;
73 } // namespace ash