Chromium Code Reviews| 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 3a7e71dbcb9a8cf5fb213b702df2627165e113b6..9a5ff2685fd5a4a2f52ce37e8e5be5497c5e1245 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))); |
| @@ -624,6 +624,26 @@ void WindowTreeClient::SetEventObserver(mojom::EventMatcherPtr matcher) { |
| } |
| } |
| +void WindowTreeClient::PerformWindowMove( |
| + Window* window, |
| + const gfx::Point& cursor_location, |
| + const base::Callback<void(bool)>& callback) { |
| + if (!on_current_move_finished_.is_null()) { |
| + NOTREACHED(); |
| + callback.Run(false); |
|
sky
2016/06/24 19:59:00
Why are you calling callback.Run(false) here? I re
|
| + } |
| + on_current_move_finished_ = callback; |
| + |
| + const uint32_t change_id = ScheduleInFlightChange( |
| + base::WrapUnique(new InFlightMoveLoopChange(window))); |
| + // Tell the window manager to take over moving us. |
| + tree_->PerformWindowMove(change_id, window->server_id(), cursor_location); |
| +} |
| + |
| +void WindowTreeClient::CancelWindowMove(Window* window) { |
| + tree_->CancelWindowMove(window->server_id()); |
| +} |
| + |
| Window* WindowTreeClient::NewWindow( |
| const Window::SharedProperties* properties) { |
| return NewWindowImpl(NewWindowType::CHILD, properties); |
| @@ -1021,6 +1041,16 @@ void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) { |
| } |
| } |
| +void WindowTreeClient::OnMoveLoopCompleted(uint32_t change_id, bool success) { |
| + std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); |
| + in_flight_map_.erase(change_id); |
| + if (!change) |
| + return; |
| + |
| + on_current_move_finished_.Run(success); |
| + on_current_move_finished_.Reset(); |
| +} |
| + |
| void WindowTreeClient::GetWindowManager( |
| mojo::AssociatedInterfaceRequest<WindowManager> internal) { |
| window_manager_internal_.reset( |
| @@ -1069,9 +1099,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 +1138,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 +1147,19 @@ void WindowTreeClient::WmClientJankinessChanged(ClientSpecificId client_id, |
| } |
| } |
| +void WindowTreeClient::WmPerformMoveLoop(uint32_t change_id, |
| + Id window_id, |
| + const gfx::Point& cursor_location) { |
| + if (window_manager_delegate_) |
| + window_manager_delegate_->OnWmPerformMoveLoop(change_id, window_id, |
|
sky
2016/06/24 19:59:00
This and OnWmCancelMoveLoop() should take the wind
|
| + cursor_location); |
| +} |
| + |
| +void WindowTreeClient::WmCancelMoveLoop(uint32_t window_id) { |
| + if (window_manager_delegate_) |
| + window_manager_delegate_->OnWmCancelMoveLoop(window_id); |
| +} |
| + |
| void WindowTreeClient::OnAccelerator(uint32_t id, |
| std::unique_ptr<ui::Event> event) { |
| DCHECK(event); |
| @@ -1132,7 +1175,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); |
| } |
| @@ -1178,4 +1221,12 @@ void WindowTreeClient::SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| } |
| } |
| +void WindowTreeClient::OnWmMoveLoopCompleted(uint32_t change_id, |
| + bool completed) { |
| + if (window_manager_internal_client_) { |
| + window_manager_internal_client_->OnWmMoveLoopCompleted(change_id, |
| + completed); |
| + } |
| +} |
| + |
| } // namespace mus |