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 <utility> |
| 8 |
7 #include "ash/public/cpp/window_properties.h" | 9 #include "ash/public/cpp/window_properties.h" |
8 #include "ash/shelf/shelf_controller.h" | 10 #include "ash/shelf/shelf_controller.h" |
9 #include "ash/shelf/shelf_model.h" | 11 #include "ash/shelf/shelf_model.h" |
10 #include "ash/shell.h" | 12 #include "ash/shell.h" |
11 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
12 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
13 #include "ash/wm_window.h" | 15 #include "ash/wm_window.h" |
14 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
15 #include "ui/events/event_constants.h" | 17 #include "ui/events/event_constants.h" |
16 | 18 |
(...skipping 16 matching lines...) Expand all Loading... |
33 DCHECK(!id.IsNull()); | 35 DCHECK(!id.IsNull()); |
34 DCHECK(window_); | 36 DCHECK(window_); |
35 } | 37 } |
36 | 38 |
37 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {} | 39 ShelfWindowWatcherItemDelegate::~ShelfWindowWatcherItemDelegate() {} |
38 | 40 |
39 void ShelfWindowWatcherItemDelegate::ItemSelected( | 41 void ShelfWindowWatcherItemDelegate::ItemSelected( |
40 std::unique_ptr<ui::Event> event, | 42 std::unique_ptr<ui::Event> event, |
41 int64_t display_id, | 43 int64_t display_id, |
42 ShelfLaunchSource source, | 44 ShelfLaunchSource source, |
43 const ItemSelectedCallback& callback) { | 45 ItemSelectedCallback callback) { |
44 // Move panels attached on another display to the current display. | 46 // Move panels attached on another display to the current display. |
45 if (GetShelfItemType(shelf_id()) == TYPE_APP_PANEL && | 47 if (GetShelfItemType(shelf_id()) == TYPE_APP_PANEL && |
46 window_->aura_window()->GetProperty(kPanelAttachedKey) && | 48 window_->aura_window()->GetProperty(kPanelAttachedKey) && |
47 wm::MoveWindowToDisplay(window_->aura_window(), display_id)) { | 49 wm::MoveWindowToDisplay(window_->aura_window(), display_id)) { |
48 window_->Activate(); | 50 window_->Activate(); |
49 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); | 51 std::move(callback).Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); |
50 return; | 52 return; |
51 } | 53 } |
52 | 54 |
53 if (window_->IsActive()) { | 55 if (window_->IsActive()) { |
54 if (event && event->type() == ui::ET_KEY_RELEASED) { | 56 if (event && event->type() == ui::ET_KEY_RELEASED) { |
55 window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 57 window_->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
56 callback.Run(SHELF_ACTION_NONE, base::nullopt); | 58 std::move(callback).Run(SHELF_ACTION_NONE, base::nullopt); |
57 return; | 59 return; |
58 } | 60 } |
59 window_->Minimize(); | 61 window_->Minimize(); |
60 callback.Run(SHELF_ACTION_WINDOW_MINIMIZED, base::nullopt); | 62 std::move(callback).Run(SHELF_ACTION_WINDOW_MINIMIZED, base::nullopt); |
61 return; | 63 return; |
62 } | 64 } |
63 window_->Activate(); | 65 window_->Activate(); |
64 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); | 66 std::move(callback).Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); |
65 } | 67 } |
66 | 68 |
67 void ShelfWindowWatcherItemDelegate::ExecuteCommand(uint32_t command_id, | 69 void ShelfWindowWatcherItemDelegate::ExecuteCommand(uint32_t command_id, |
68 int32_t event_flags) {} | 70 int32_t event_flags) {} |
69 | 71 |
70 void ShelfWindowWatcherItemDelegate::Close() { | 72 void ShelfWindowWatcherItemDelegate::Close() { |
71 window_->CloseWidget(); | 73 window_->CloseWidget(); |
72 } | 74 } |
73 | 75 |
74 } // namespace ash | 76 } // namespace ash |
OLD | NEW |