Index: components/mus/public/cpp/lib/window_tree_client.cc |
diff --git a/components/mus/public/cpp/lib/window_tree_client.cc b/components/mus/public/cpp/lib/window_tree_client.cc |
index 7a43101ff6a809ad755b710c8bb4739fd90096c1..3211d33a909540a38605a786c06bf002ebd37a9a 100644 |
--- a/components/mus/public/cpp/lib/window_tree_client.cc |
+++ b/components/mus/public/cpp/lib/window_tree_client.cc |
@@ -232,8 +232,8 @@ bool WindowTreeClient::OwnsWindow(Window* window) const { |
} |
void WindowTreeClient::SetBounds(Window* window, |
- const gfx::Rect& old_bounds, |
- const gfx::Rect& bounds) { |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& bounds) { |
DCHECK(tree_); |
const uint32_t change_id = ScheduleInFlightChange( |
base::WrapUnique(new InFlightBoundsChange(window, old_bounds))); |
@@ -580,6 +580,14 @@ void WindowTreeClient::OnReceivedCursorLocationMemory( |
DCHECK(cursor_location_mapping_); |
} |
+void WindowTreeClient::OnWmMoveLoopCompleted(uint32_t change_id, |
+ bool completed) { |
+ if (window_manager_internal_client_) { |
+ window_manager_internal_client_->OnWmMoveLoopCompleted(change_id, |
+ completed); |
+ } |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// WindowTreeClient, WindowTreeClient implementation: |
@@ -624,6 +632,25 @@ void WindowTreeClient::SetEventObserver(mojom::EventMatcherPtr matcher) { |
} |
} |
+void WindowTreeClient::PerformWindowMove( |
+ Window* window, |
+ ::mus::mojom::MoveLoopSource source, |
+ const gfx::Point& cursor_location, |
+ const base::Callback<void(bool)>& callback) { |
+ DCHECK(on_current_move_finished_.is_null()); |
+ on_current_move_finished_ = callback; |
+ |
+ current_move_loop_change_ = ScheduleInFlightChange( |
+ base::WrapUnique(new InFlightMoveLoopChange(window))); |
+ // Tell the window manager to take over moving us. |
+ tree_->PerformWindowMove(current_move_loop_change_, window->server_id(), |
+ source, cursor_location); |
+} |
+ |
+void WindowTreeClient::CancelWindowMove(Window* window) { |
+ tree_->CancelWindowMove(window->server_id()); |
+} |
+ |
Window* WindowTreeClient::NewWindow( |
const Window::SharedProperties* properties) { |
return NewWindowImpl(NewWindowType::CHILD, properties); |
@@ -1019,6 +1046,12 @@ void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) { |
} else if (!success) { |
change->Revert(); |
} |
+ |
+ if (change_id == current_move_loop_change_) { |
+ on_current_move_finished_.Run(success); |
+ on_current_move_finished_.Reset(); |
+ current_move_loop_change_ = 0; |
sky
2016/06/29 00:04:08
Please move current_move_loop_change_ = 0 before t
|
+ } |
} |
void WindowTreeClient::GetWindowManager( |
@@ -1069,9 +1102,9 @@ void WindowTreeClient::WmSetBounds(uint32_t change_id, |
} |
void WindowTreeClient::WmSetProperty(uint32_t change_id, |
- Id window_id, |
- const mojo::String& name, |
- mojo::Array<uint8_t> transit_data) { |
+ Id window_id, |
+ const mojo::String& name, |
+ mojo::Array<uint8_t> transit_data) { |
Window* window = GetWindowByServerId(window_id); |
bool result = false; |
if (window) { |
@@ -1108,7 +1141,7 @@ void WindowTreeClient::WmCreateTopLevelWindow( |
} |
void WindowTreeClient::WmClientJankinessChanged(ClientSpecificId client_id, |
- bool janky) { |
+ bool janky) { |
if (window_manager_delegate_) { |
auto it = embedded_windows_.find(client_id); |
CHECK(it != embedded_windows_.end()); |
@@ -1117,6 +1150,24 @@ void WindowTreeClient::WmClientJankinessChanged(ClientSpecificId client_id, |
} |
} |
+void WindowTreeClient::WmPerformMoveLoop(uint32_t change_id, |
+ Id window_id, |
+ ::mus::mojom::MoveLoopSource source, |
+ const gfx::Point& cursor_location) { |
+ if (window_manager_delegate_) { |
sky
2016/06/29 00:04:08
If there is no window for id, immediately call OnW
|
+ window_manager_delegate_->OnWmPerformMoveLoop( |
+ GetWindowByServerId(window_id), source, cursor_location, |
+ base::Bind(&WindowTreeClient::OnWmMoveLoopCompleted, |
+ weak_factory_.GetWeakPtr(), change_id)); |
+ } |
+} |
+ |
+void WindowTreeClient::WmCancelMoveLoop(uint32_t window_id) { |
+ if (window_manager_delegate_) |
sky
2016/06/29 00:04:08
As WmCancelMoveLoop is async, it's entirely possib
|
+ window_manager_delegate_->OnWmCancelMoveLoop( |
+ GetWindowByServerId(window_id)); |
+} |
+ |
void WindowTreeClient::OnAccelerator(uint32_t id, |
std::unique_ptr<ui::Event> event) { |
DCHECK(event); |
@@ -1132,7 +1183,7 @@ void WindowTreeClient::SetFrameDecorationValues( |
} |
void WindowTreeClient::SetNonClientCursor(Window* window, |
- mus::mojom::Cursor cursor_id) { |
+ mus::mojom::Cursor cursor_id) { |
window_manager_internal_client_->WmSetNonClientCursor(server_id(window), |
cursor_id); |
} |