Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ash/shelf/shelf_window_watcher_item_delegate.cc

Issue 2211463002: mash: Move ShelfWindowWatcher[ItemDelegate] to ash/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO comments with bug for WmWindowMus ShelfItemDetails support. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « ash/shelf/shelf_window_watcher_item_delegate.h ('k') | ash/shelf/shelf_window_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698