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

Unified Diff: ash/mus/move_event_handler.cc

Issue 2905893002: chromeos: convert more ash/wm code to aura::Window (Closed)
Patch Set: moar cleanup Created 3 years, 7 months 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
Index: ash/mus/move_event_handler.cc
diff --git a/ash/mus/move_event_handler.cc b/ash/mus/move_event_handler.cc
index 0051d49b5e2893386a30d126254e17a4d68478b1..17375bd11d76ffcacf984f92055bdb90fcf321a9 100644
--- a/ash/mus/move_event_handler.cc
+++ b/ash/mus/move_event_handler.cc
@@ -5,10 +5,11 @@
#include "ash/mus/move_event_handler.h"
#include "ash/mus/bridge/workspace_event_handler_mus.h"
-#include "ash/wm_window.h"
+#include "ash/wm/window_util.h"
#include "services/ui/public/interfaces/cursor/cursor.mojom.h"
#include "ui/aura/mus/window_manager_delegate.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_delegate.h"
#include "ui/base/class_property.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
@@ -63,8 +64,7 @@ void OnMoveLoopCompleted(const base::Callback<void(bool success)>& end_closure,
MoveEventHandler::MoveEventHandler(
aura::WindowManagerClient* window_manager_client,
aura::Window* window)
- : wm_window_(WmWindow::Get(window)),
- window_manager_client_(window_manager_client) {
+ : window_(window), window_manager_client_(window_manager_client) {
window->AddObserver(this);
window->AddPreTargetHandler(this);
@@ -76,8 +76,8 @@ MoveEventHandler::~MoveEventHandler() {
}
// static
-MoveEventHandler* MoveEventHandler::GetForWindow(WmWindow* wm_window) {
- return WmWindow::GetAuraWindow(wm_window)->GetProperty(kWmMoveEventHandler);
+MoveEventHandler* MoveEventHandler::GetForWindow(aura::Window* window) {
+ return window->GetProperty(kWmMoveEventHandler);
}
void MoveEventHandler::AttemptToStartDrag(
@@ -86,7 +86,7 @@ void MoveEventHandler::AttemptToStartDrag(
aura::client::WindowMoveSource source,
const base::Callback<void(bool success)>& end_closure) {
toplevel_window_event_handler_.AttemptToStartDrag(
- wm_window_, point_in_parent, window_component, source,
+ window_, point_in_parent, window_component, source,
base::Bind(&OnMoveLoopCompleted, end_closure));
}
@@ -99,47 +99,46 @@ void MoveEventHandler::RevertDrag() {
}
void MoveEventHandler::Detach() {
- if (!wm_window_)
+ if (!window_)
return;
- wm_window_->aura_window()->RemoveObserver(this);
- wm_window_->aura_window()->RemovePreTargetHandler(this);
- wm_window_->aura_window()->ClearProperty(kWmMoveEventHandler);
- wm_window_ = nullptr;
+ window_->RemoveObserver(this);
+ window_->RemovePreTargetHandler(this);
+ window_->ClearProperty(kWmMoveEventHandler);
+ window_ = nullptr;
}
WorkspaceEventHandlerMus* MoveEventHandler::GetWorkspaceEventHandlerMus() {
- if (!wm_window_->GetParent())
+ if (!window_->parent())
return nullptr;
- return WorkspaceEventHandlerMus::Get(wm_window_->aura_window()->parent());
+ return WorkspaceEventHandlerMus::Get(window_->parent());
}
void MoveEventHandler::OnMouseEvent(ui::MouseEvent* event) {
- toplevel_window_event_handler_.OnMouseEvent(event, wm_window_);
+ toplevel_window_event_handler_.OnMouseEvent(event, window_);
if (!toplevel_window_event_handler_.is_drag_in_progress() &&
(event->type() == ui::ET_POINTER_MOVED ||
event->type() == ui::ET_MOUSE_MOVED)) {
const int hit_test_location =
- wm_window_->GetNonClientComponent(event->location());
+ wm::GetNonClientComponent(window_, event->location());
window_manager_client_->SetNonClientCursor(
- wm_window_->aura_window(),
- ui::CursorData(CursorForWindowComponent(hit_test_location)));
+ window_, ui::CursorData(CursorForWindowComponent(hit_test_location)));
}
WorkspaceEventHandlerMus* workspace_event_handler =
GetWorkspaceEventHandlerMus();
if (workspace_event_handler)
- workspace_event_handler->OnMouseEvent(event, wm_window_);
+ workspace_event_handler->OnMouseEvent(event, window_);
}
void MoveEventHandler::OnGestureEvent(ui::GestureEvent* event) {
- toplevel_window_event_handler_.OnGestureEvent(event, wm_window_);
+ toplevel_window_event_handler_.OnGestureEvent(event, window_);
WorkspaceEventHandlerMus* workspace_event_handler =
GetWorkspaceEventHandlerMus();
if (workspace_event_handler)
- workspace_event_handler->OnGestureEvent(event, wm_window_);
+ workspace_event_handler->OnGestureEvent(event, window_);
}
void MoveEventHandler::OnCancelMode(ui::CancelModeEvent* event) {
@@ -147,7 +146,7 @@ void MoveEventHandler::OnCancelMode(ui::CancelModeEvent* event) {
}
void MoveEventHandler::OnWindowDestroying(aura::Window* window) {
- DCHECK_EQ(wm_window_->aura_window(), window);
+ DCHECK_EQ(window_, window);
Detach();
}

Powered by Google App Engine
This is Rietveld 408576698