| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/ws/drag_controller.h" | 5 #include "services/ui/ws/drag_controller.h" |
| 6 | 6 |
| 7 #include "services/ui/ws/drag_source.h" | 7 #include "services/ui/ws/drag_source.h" |
| 8 #include "services/ui/ws/drag_target_connection.h" | 8 #include "services/ui/ws/drag_target_connection.h" |
| 9 #include "services/ui/ws/ids.h" | 9 #include "services/ui/ws/ids.h" |
| 10 #include "services/ui/ws/server_window.h" | 10 #include "services/ui/ws/server_window.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 server_window_by_id_[id] = p->window(); | 137 server_window_by_id_[id] = p->window(); |
| 138 connection_by_window_[p->window()] = p.get(); | 138 connection_by_window_[p->window()] = p.get(); |
| 139 return p; | 139 return p; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void StartDragOperation( | 142 void StartDragOperation( |
| 143 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data, | 143 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data, |
| 144 DragTestWindow* window, | 144 DragTestWindow* window, |
| 145 uint32_t drag_operations) { | 145 uint32_t drag_operations) { |
| 146 window->PerformOnDragDropStart(mime_data.Clone()); | 146 window->PerformOnDragDropStart(mime_data.Clone()); |
| 147 drag_operation_.reset(new DragController( | 147 drag_operation_ = base::MakeUnique<DragController>( |
| 148 this, window->window(), window, PointerEvent::kMousePointerId, | 148 this, window->window(), window, PointerEvent::kMousePointerId, |
| 149 std::move(mime_data), drag_operations)); | 149 std::move(mime_data), drag_operations); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void DispatchDrag(DragTestWindow* window, | 152 void DispatchDrag(DragTestWindow* window, |
| 153 bool mouse_released, | 153 bool mouse_released, |
| 154 uint32_t flags, | 154 uint32_t flags, |
| 155 const gfx::Point& position) { | 155 const gfx::Point& position) { |
| 156 ui::PointerEvent event( | 156 ui::PointerEvent event( |
| 157 ui::MouseEvent(mouse_released ? ET_MOUSE_RELEASED : ET_MOUSE_PRESSED, | 157 ui::MouseEvent(mouse_released ? ET_MOUSE_RELEASED : ET_MOUSE_PRESSED, |
| 158 position, position, ui::EventTimeForNow(), flags, 0)); | 158 position, position, ui::EventTimeForNow(), flags, 0)); |
| 159 drag_operation_->DispatchPointerEvent(event, | 159 drag_operation_->DispatchPointerEvent(event, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 185 } | 185 } |
| 186 const base::Optional<bool>& drag_completed_value() { | 186 const base::Optional<bool>& drag_completed_value() { |
| 187 return drag_completed_value_; | 187 return drag_completed_value_; |
| 188 } | 188 } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 // Overridden from testing::Test: | 191 // Overridden from testing::Test: |
| 192 void SetUp() override { | 192 void SetUp() override { |
| 193 testing::Test::SetUp(); | 193 testing::Test::SetUp(); |
| 194 | 194 |
| 195 window_delegate_.reset(new TestServerWindowDelegate()); | 195 window_delegate_ = base::MakeUnique<TestServerWindowDelegate>(); |
| 196 root_window_.reset( | 196 root_window_ = |
| 197 new ServerWindow(window_delegate_.get(), WindowId(1, 2))); | 197 base::MakeUnique<ServerWindow>(window_delegate_.get(), WindowId(1, 2)); |
| 198 window_delegate_->set_root_window(root_window_.get()); | 198 window_delegate_->set_root_window(root_window_.get()); |
| 199 root_window_->SetVisible(true); | 199 root_window_->SetVisible(true); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void TearDown() override { | 202 void TearDown() override { |
| 203 drag_operation_.reset(); | 203 drag_operation_.reset(); |
| 204 root_window_.reset(); | 204 root_window_.reset(); |
| 205 window_delegate_.reset(); | 205 window_delegate_.reset(); |
| 206 | 206 |
| 207 DCHECK(server_window_by_id_.empty()); | 207 DCHECK(server_window_by_id_.empty()); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 gfx::Point(1, 1)); | 608 gfx::Point(1, 1)); |
| 609 ASSERT_EQ(0u, window->queue_size()); | 609 ASSERT_EQ(0u, window->queue_size()); |
| 610 } | 610 } |
| 611 | 611 |
| 612 // TODO(erg): Add a test to ensure windows that the cursor isn't over | 612 // TODO(erg): Add a test to ensure windows that the cursor isn't over |
| 613 // responding to messages don't change the cursor when we have cursor handling | 613 // responding to messages don't change the cursor when we have cursor handling |
| 614 // code. | 614 // code. |
| 615 | 615 |
| 616 } // namespace ws | 616 } // namespace ws |
| 617 } // namespace ui | 617 } // namespace ui |
| OLD | NEW |