OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shelf/shelf_window_watcher_item_delegate.h" | 5 #include "ash/shelf/shelf_window_watcher_item_delegate.h" |
6 | 6 |
| 7 #include "ash/shelf/shelf_model.h" |
7 #include "ash/shelf/shelf_util.h" | 8 #include "ash/shelf/shelf_util.h" |
| 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" |
8 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
9 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
10 #include "ui/views/corewm/window_animations.h" | 13 #include "ui/views/corewm/window_animations.h" |
11 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
12 | 15 |
13 namespace ash { | 16 namespace ash { |
14 namespace internal { | 17 namespace internal { |
15 | 18 |
16 ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate( | 19 ShelfWindowWatcherItemDelegate::ShelfWindowWatcherItemDelegate( |
17 aura::Window* window) | 20 aura::Window* window, ShelfModel* model) |
18 : window_(window) { | 21 : window_(window), |
| 22 model_(model) { |
19 } | 23 } |
20 | 24 |
21 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() { | 25 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() { |
22 } | 26 } |
23 | 27 |
24 void ShelfWindowWatcherItemDelegate::Close() { | 28 void ShelfWindowWatcherItemDelegate::Close() { |
25 views::Widget::GetWidgetForNativeWindow(window_)->Close(); | 29 views::Widget::GetWidgetForNativeWindow(window_)->Close(); |
26 } | 30 } |
27 | 31 |
28 bool ShelfWindowWatcherItemDelegate::ItemSelected(const ui::Event& event) { | 32 bool ShelfWindowWatcherItemDelegate::ItemSelected(const ui::Event& event) { |
(...skipping 11 matching lines...) Expand all Loading... |
40 | 44 |
41 return false; | 45 return false; |
42 } | 46 } |
43 | 47 |
44 base::string16 ShelfWindowWatcherItemDelegate::GetTitle() { | 48 base::string16 ShelfWindowWatcherItemDelegate::GetTitle() { |
45 return GetLauncherItemDetailsForWindow(window_)->title; | 49 return GetLauncherItemDetailsForWindow(window_)->title; |
46 } | 50 } |
47 | 51 |
48 ui::MenuModel* ShelfWindowWatcherItemDelegate::CreateContextMenu( | 52 ui::MenuModel* ShelfWindowWatcherItemDelegate::CreateContextMenu( |
49 aura::Window* root_window) { | 53 aura::Window* root_window) { |
50 // TODO(simonhong): Create ShelfItemContextMenu. | 54 ash::LauncherItem item = |
51 return NULL; | 55 *(model_->ItemByID(GetLauncherIDForWindow(window_))); |
| 56 return Shell::GetInstance()->delegate()->CreateContextMenu(root_window, |
| 57 this, |
| 58 &item); |
52 } | 59 } |
53 | 60 |
54 ShelfMenuModel* ShelfWindowWatcherItemDelegate::CreateApplicationMenu( | 61 ShelfMenuModel* ShelfWindowWatcherItemDelegate::CreateApplicationMenu( |
55 int event_flags) { | 62 int event_flags) { |
56 return NULL; | 63 return NULL; |
57 } | 64 } |
58 | 65 |
59 bool ShelfWindowWatcherItemDelegate::IsDraggable() { | 66 bool ShelfWindowWatcherItemDelegate::IsDraggable() { |
60 return true; | 67 return true; |
61 } | 68 } |
62 | 69 |
63 bool ShelfWindowWatcherItemDelegate::ShouldShowTooltip() { | 70 bool ShelfWindowWatcherItemDelegate::ShouldShowTooltip() { |
64 return true; | 71 return true; |
65 } | 72 } |
66 | 73 |
67 } // namespace internal | 74 } // namespace internal |
68 } // namespace ash | 75 } // namespace ash |
OLD | NEW |