Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: ash/common/test/test_shelf_item_delegate.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/user/user_view.cc ('k') | ash/common/wm/overview/window_selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,11 +4,34 @@
#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 @@ ShelfItemDelegate::PerformedAction TestShelfItemDelegate::ItemSelected(
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;
« no previous file with comments | « ash/common/system/user/user_view.cc ('k') | ash/common/wm/overview/window_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698