| 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/common/test/test_shelf_item_delegate.h" | 5 #include "ash/common/test/test_shelf_item_delegate.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_window.h" | 7 #include "ash/common/wm_window.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 | 9 |
| 10 namespace ash { | 10 namespace ash { |
| 11 namespace test { | 11 namespace test { |
| 12 | 12 |
| 13 TestShelfItemDelegate::TestShelfItemDelegate(WmWindow* window) | 13 TestShelfItemDelegate::TestShelfItemDelegate(WmWindow* window) |
| 14 : window_(window) {} | 14 : ShelfItemDelegate(AppLaunchId()), window_(window) {} |
| 15 | 15 |
| 16 TestShelfItemDelegate::~TestShelfItemDelegate() {} | 16 TestShelfItemDelegate::~TestShelfItemDelegate() {} |
| 17 | 17 |
| 18 void TestShelfItemDelegate::ItemSelected(std::unique_ptr<ui::Event> event, | 18 void TestShelfItemDelegate::ItemSelected(std::unique_ptr<ui::Event> event, |
| 19 int64_t display_id, | 19 int64_t display_id, |
| 20 ShelfLaunchSource source, | 20 ShelfLaunchSource source, |
| 21 const ItemSelectedCallback& callback) { | 21 const ItemSelectedCallback& callback) { |
| 22 if (window_) { | 22 if (window_) { |
| 23 if (window_->GetType() == ui::wm::WINDOW_TYPE_PANEL) | 23 if (window_->GetType() == ui::wm::WINDOW_TYPE_PANEL) |
| 24 wm::MoveWindowToDisplay(window_->aura_window(), display_id); | 24 wm::MoveWindowToDisplay(window_->aura_window(), display_id); |
| 25 window_->Show(); | 25 window_->Show(); |
| 26 window_->Activate(); | 26 window_->Activate(); |
| 27 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); | 27 callback.Run(SHELF_ACTION_WINDOW_ACTIVATED, base::nullopt); |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 callback.Run(SHELF_ACTION_NONE, base::nullopt); | 30 callback.Run(SHELF_ACTION_NONE, base::nullopt); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void TestShelfItemDelegate::ExecuteCommand(uint32_t command_id, | 33 void TestShelfItemDelegate::ExecuteCommand(uint32_t command_id, |
| 34 int32_t event_flags) { | 34 int32_t event_flags) { |
| 35 // This delegate does not support showing an application menu. | 35 // This delegate does not support showing an application menu. |
| 36 NOTIMPLEMENTED(); | 36 NOTIMPLEMENTED(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void TestShelfItemDelegate::Close() {} | 39 void TestShelfItemDelegate::Close() {} |
| 40 | 40 |
| 41 } // namespace test | 41 } // namespace test |
| 42 } // namespace ash | 42 } // namespace ash |
| OLD | NEW |