| 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/shelf/shelf_window_watcher_item_delegate.h" | |
| 6 | |
| 7 #include "ash/common/wm/window_state.h" | |
| 8 #include "ash/common/wm_window.h" | |
| 9 #include "ash/shelf/shelf_util.h" | |
| 10 #include "ui/events/event.h" | |
| 11 #include "ui/wm/core/window_animations.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 | |
| 15 ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate(WmWindow* window) | |
| 16 : window_(window) {} | |
| 17 | |
| 18 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {} | |
| 19 | |
| 20 ShelfItemDelegate::PerformedAction ShelfWindowWatcherItemDelegate::ItemSelected( | |
| 21 const ui::Event& event) { | |
| 22 wm::WindowState* window_state = window_->GetWindowState(); | |
| 23 if (window_state->IsActive()) { | |
| 24 if (event.type() & ui::ET_KEY_RELEASED) { | |
| 25 window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); | |
| 26 return kNoAction; | |
| 27 } else { | |
| 28 window_state->Minimize(); | |
| 29 return kExistingWindowMinimized; | |
| 30 } | |
| 31 } else { | |
| 32 window_state->Activate(); | |
| 33 return kExistingWindowActivated; | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 base::string16 ShelfWindowWatcherItemDelegate::GetTitle() { | |
| 38 return window_->GetShelfItemDetails()->title; | |
| 39 } | |
| 40 | |
| 41 ShelfMenuModel* ShelfWindowWatcherItemDelegate::CreateApplicationMenu( | |
| 42 int event_flags) { | |
| 43 return nullptr; | |
| 44 } | |
| 45 | |
| 46 bool ShelfWindowWatcherItemDelegate::IsDraggable() { | |
| 47 return true; | |
| 48 } | |
| 49 | |
| 50 bool ShelfWindowWatcherItemDelegate::CanPin() const { | |
| 51 return true; | |
| 52 } | |
| 53 | |
| 54 bool ShelfWindowWatcherItemDelegate::ShouldShowTooltip() { | |
| 55 return true; | |
| 56 } | |
| 57 | |
| 58 void ShelfWindowWatcherItemDelegate::Close() { | |
| 59 window_->CloseWidget(); | |
| 60 } | |
| 61 | |
| 62 } // namespace ash | |
| OLD | NEW |