| 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 | 8 |
| 9 namespace ash { | 9 namespace ash { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 TestShelfItemDelegate::TestShelfItemDelegate(WmWindow* window) | 12 TestShelfItemDelegate::TestShelfItemDelegate(WmWindow* window) |
| 13 : window_(window), is_draggable_(true) {} | 13 : window_(window) {} |
| 14 | 14 |
| 15 TestShelfItemDelegate::~TestShelfItemDelegate() {} | 15 TestShelfItemDelegate::~TestShelfItemDelegate() {} |
| 16 | 16 |
| 17 ShelfItemDelegate::PerformedAction TestShelfItemDelegate::ItemSelected( | 17 ShelfItemDelegate::PerformedAction TestShelfItemDelegate::ItemSelected( |
| 18 const ui::Event& event) { | 18 const ui::Event& event) { |
| 19 if (window_) { | 19 if (window_) { |
| 20 if (window_->GetType() == ui::wm::WINDOW_TYPE_PANEL) | 20 if (window_->GetType() == ui::wm::WINDOW_TYPE_PANEL) |
| 21 window_->MoveToEventRoot(event); | 21 window_->MoveToEventRoot(event); |
| 22 window_->Show(); | 22 window_->Show(); |
| 23 window_->Activate(); | 23 window_->Activate(); |
| 24 return kExistingWindowActivated; | 24 return kExistingWindowActivated; |
| 25 } | 25 } |
| 26 return kNoAction; | 26 return kNoAction; |
| 27 } | 27 } |
| 28 | 28 |
| 29 base::string16 TestShelfItemDelegate::GetTitle() { | 29 base::string16 TestShelfItemDelegate::GetTitle() { |
| 30 return window_ ? window_->GetTitle() : base::string16(); | 30 return window_ ? window_->GetTitle() : base::string16(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ShelfMenuModel* TestShelfItemDelegate::CreateApplicationMenu(int event_flags) { | 33 ShelfMenuModel* TestShelfItemDelegate::CreateApplicationMenu(int event_flags) { |
| 34 return nullptr; | 34 return nullptr; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool TestShelfItemDelegate::IsDraggable() { | |
| 38 return is_draggable_; | |
| 39 } | |
| 40 | |
| 41 bool TestShelfItemDelegate::CanPin() const { | 37 bool TestShelfItemDelegate::CanPin() const { |
| 42 return true; | 38 return true; |
| 43 } | 39 } |
| 44 | 40 |
| 45 void TestShelfItemDelegate::Close() {} | 41 void TestShelfItemDelegate::Close() {} |
| 46 | 42 |
| 47 } // namespace test | 43 } // namespace test |
| 48 } // namespace ash | 44 } // namespace ash |
| OLD | NEW |