| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 const std::string& name, | 230 const std::string& name, |
| 231 const std::vector<uint8_t>* data) { | 231 const std::vector<uint8_t>* data) { |
| 232 base::Optional<std::vector<uint8_t>> mojo_data; | 232 base::Optional<std::vector<uint8_t>> mojo_data; |
| 233 if (data) | 233 if (data) |
| 234 mojo_data.emplace(*data); | 234 mojo_data.emplace(*data); |
| 235 const uint32_t change_id = GetAndAdvanceChangeId(); | 235 const uint32_t change_id = GetAndAdvanceChangeId(); |
| 236 tree()->SetWindowProperty(change_id, window_id, name, mojo_data); | 236 tree()->SetWindowProperty(change_id, window_id, name, mojo_data); |
| 237 return WaitForChangeCompleted(change_id); | 237 return WaitForChangeCompleted(change_id); |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool SetPredefinedCursor(Id window_id, mojom::Cursor cursor) { | 240 bool SetPredefinedCursor(Id window_id, mojom::CursorType cursor) { |
| 241 const uint32_t change_id = GetAndAdvanceChangeId(); | 241 const uint32_t change_id = GetAndAdvanceChangeId(); |
| 242 tree()->SetPredefinedCursor(change_id, window_id, cursor); | 242 tree()->SetPredefinedCursor(change_id, window_id, cursor); |
| 243 return WaitForChangeCompleted(change_id); | 243 return WaitForChangeCompleted(change_id); |
| 244 } | 244 } |
| 245 | 245 |
| 246 bool SetWindowVisibility(Id window_id, bool visible) { | 246 bool SetWindowVisibility(Id window_id, bool visible) { |
| 247 const uint32_t change_id = GetAndAdvanceChangeId(); | 247 const uint32_t change_id = GetAndAdvanceChangeId(); |
| 248 tree()->SetWindowVisibility(change_id, window_id, visible); | 248 tree()->SetWindowVisibility(change_id, window_id, visible); |
| 249 return WaitForChangeCompleted(change_id); | 249 return WaitForChangeCompleted(change_id); |
| 250 } | 250 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 int64_t display_id) override {} | 376 int64_t display_id) override {} |
| 377 void OnWindowSharedPropertyChanged( | 377 void OnWindowSharedPropertyChanged( |
| 378 uint32_t window, | 378 uint32_t window, |
| 379 const std::string& name, | 379 const std::string& name, |
| 380 const base::Optional<std::vector<uint8_t>>& new_data) override { | 380 const base::Optional<std::vector<uint8_t>>& new_data) override { |
| 381 tracker_.OnWindowSharedPropertyChanged(window, name, new_data); | 381 tracker_.OnWindowSharedPropertyChanged(window, name, new_data); |
| 382 } | 382 } |
| 383 // TODO(sky): add testing coverage. | 383 // TODO(sky): add testing coverage. |
| 384 void OnWindowFocused(uint32_t focused_window_id) override {} | 384 void OnWindowFocused(uint32_t focused_window_id) override {} |
| 385 void OnWindowPredefinedCursorChanged(uint32_t window_id, | 385 void OnWindowPredefinedCursorChanged(uint32_t window_id, |
| 386 mojom::Cursor cursor_id) override { | 386 mojom::CursorType cursor_id) override { |
| 387 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); | 387 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void OnDragDropStart( | 390 void OnDragDropStart( |
| 391 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data) | 391 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data) |
| 392 override { | 392 override { |
| 393 NOTIMPLEMENTED(); | 393 NOTIMPLEMENTED(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void OnWindowSurfaceChanged(Id window_id, | 396 void OnWindowSurfaceChanged(Id window_id, |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 // Test that we hear the cursor change in other clients. | 1626 // Test that we hear the cursor change in other clients. |
| 1627 TEST_F(WindowTreeClientTest, SetCursor) { | 1627 TEST_F(WindowTreeClientTest, SetCursor) { |
| 1628 // Get a second client to listen in. | 1628 // Get a second client to listen in. |
| 1629 ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true)); | 1629 ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true)); |
| 1630 Id window_1_1 = BuildWindowId(client_id_1(), 1); | 1630 Id window_1_1 = BuildWindowId(client_id_1(), 1); |
| 1631 changes2()->clear(); | 1631 changes2()->clear(); |
| 1632 | 1632 |
| 1633 ASSERT_TRUE( | 1633 ASSERT_TRUE( |
| 1634 wt_client1()->SetPredefinedCursor(window_1_1, mojom::Cursor::IBEAM)); | 1634 wt_client1()->SetPredefinedCursor(window_1_1, mojom::CursorType::IBEAM)); |
| 1635 wt_client2_->WaitForChangeCount(1u); | 1635 wt_client2_->WaitForChangeCount(1u); |
| 1636 | 1636 |
| 1637 EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4", | 1637 EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4", |
| 1638 SingleChangeToDescription(*changes2())); | 1638 SingleChangeToDescription(*changes2())); |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 // Assertions for SetWindowVisibility sending notifications. | 1641 // Assertions for SetWindowVisibility sending notifications. |
| 1642 TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications) { | 1642 TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications) { |
| 1643 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. | 1643 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. |
| 1644 Id window_1_1 = wt_client1()->NewWindow(1); | 1644 Id window_1_1 = wt_client1()->NewWindow(1); |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 | 2262 |
| 2263 // TODO(sky): make sure coverage of what was | 2263 // TODO(sky): make sure coverage of what was |
| 2264 // WindowManagerTest.SecondEmbedRoot_InitService and | 2264 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 2265 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 2265 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 2266 // manager | 2266 // manager |
| 2267 // tests. | 2267 // tests. |
| 2268 | 2268 |
| 2269 } // namespace test | 2269 } // namespace test |
| 2270 } // namespace ws | 2270 } // namespace ws |
| 2271 } // namespace ui | 2271 } // namespace ui |
| OLD | NEW |