| Index: ash/common/test/test_shelf_item_delegate.cc
|
| diff --git a/ash/common/test/test_shelf_item_delegate.cc b/ash/common/test/test_shelf_item_delegate.cc
|
| index 6983a1edf91e1fa92041498d1ca2f63817fe9b7f..96916d677e071fa598307e4d01be04f208a63b09 100644
|
| --- a/ash/common/test/test_shelf_item_delegate.cc
|
| +++ b/ash/common/test/test_shelf_item_delegate.cc
|
| @@ -4,10 +4,33 @@
|
|
|
| #include "ash/common/test/test_shelf_item_delegate.h"
|
|
|
| +#include "ash/common/wm_lookup.h"
|
| #include "ash/common/wm_window.h"
|
| +#include "ui/events/event.h"
|
| +#include "ui/views/view.h"
|
| +#include "ui/views/widget/widget.h"
|
|
|
| namespace ash {
|
| namespace test {
|
| +
|
| +namespace {
|
| +
|
| +// Moves |window| to the root window where the |event| occurred.
|
| +// Note: This was forked from ash/wm/window_util.h's wm::MoveWindowToEventRoot.
|
| +void MoveWindowToEventRoot(WmWindow* window, const ui::Event& event) {
|
| + views::View* target = static_cast<views::View*>(event.target());
|
| + if (!target)
|
| + return;
|
| + WmWindow* target_root =
|
| + WmLookup::Get()->GetWindowForWidget(target->GetWidget())->GetRootWindow();
|
| + if (!target_root || target_root == window->GetRootWindow())
|
| + return;
|
| + WmWindow* window_container = target_root->GetChildByShellWindowId(
|
| + window->GetParent()->GetShellWindowId());
|
| + window_container->AddChild(window);
|
| +}
|
| +
|
| +} // namespace
|
|
|
| TestShelfItemDelegate::TestShelfItemDelegate(WmWindow* window)
|
| : window_(window), is_draggable_(true) {}
|
| @@ -18,7 +41,7 @@
|
| const ui::Event& event) {
|
| if (window_) {
|
| if (window_->GetType() == ui::wm::WINDOW_TYPE_PANEL)
|
| - window_->MoveToEventRoot(event);
|
| + MoveWindowToEventRoot(window_, event);
|
| window_->Show();
|
| window_->Activate();
|
| return kExistingWindowActivated;
|
|
|