| 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 "services/ui/public/cpp/window_tree_client.h" | 5 #include "services/ui/public/cpp/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "services/shell/public/cpp/connector.h" | 15 #include "services/shell/public/cpp/connector.h" |
| 16 #include "services/ui/common/util.h" | 16 #include "services/ui/common/util.h" |
| 17 #include "services/ui/public/cpp/in_flight_change.h" | 17 #include "services/ui/public/cpp/in_flight_change.h" |
| 18 #include "services/ui/public/cpp/input_event_handler.h" | 18 #include "services/ui/public/cpp/input_event_handler.h" |
| 19 #include "services/ui/public/cpp/surface_id_handler.h" | |
| 20 #include "services/ui/public/cpp/window_drop_target.h" | 19 #include "services/ui/public/cpp/window_drop_target.h" |
| 21 #include "services/ui/public/cpp/window_manager_delegate.h" | 20 #include "services/ui/public/cpp/window_manager_delegate.h" |
| 22 #include "services/ui/public/cpp/window_observer.h" | 21 #include "services/ui/public/cpp/window_observer.h" |
| 23 #include "services/ui/public/cpp/window_private.h" | 22 #include "services/ui/public/cpp/window_private.h" |
| 24 #include "services/ui/public/cpp/window_tracker.h" | 23 #include "services/ui/public/cpp/window_tracker.h" |
| 25 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 24 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 26 #include "services/ui/public/cpp/window_tree_client_observer.h" | 25 #include "services/ui/public/cpp/window_tree_client_observer.h" |
| 27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 26 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
| 28 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
| 29 #include "ui/gfx/geometry/insets.h" | 28 #include "ui/gfx/geometry/insets.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 349 |
| 351 void WindowTreeClient::AttachSurface( | 350 void WindowTreeClient::AttachSurface( |
| 352 Id window_id, | 351 Id window_id, |
| 353 mojom::SurfaceType type, | 352 mojom::SurfaceType type, |
| 354 mojo::InterfaceRequest<mojom::Surface> surface, | 353 mojo::InterfaceRequest<mojom::Surface> surface, |
| 355 mojom::SurfaceClientPtr client) { | 354 mojom::SurfaceClientPtr client) { |
| 356 DCHECK(tree_); | 355 DCHECK(tree_); |
| 357 tree_->AttachSurface(window_id, type, std::move(surface), std::move(client)); | 356 tree_->AttachSurface(window_id, type, std::move(surface), std::move(client)); |
| 358 } | 357 } |
| 359 | 358 |
| 360 void WindowTreeClient::OnWindowSurfaceDetached( | |
| 361 Id window_id, | |
| 362 const cc::SurfaceSequence& sequence) { | |
| 363 DCHECK(tree_); | |
| 364 tree_->OnWindowSurfaceDetached(window_id, sequence); | |
| 365 } | |
| 366 | |
| 367 void WindowTreeClient::LocalSetCapture(Window* window) { | 359 void WindowTreeClient::LocalSetCapture(Window* window) { |
| 368 if (capture_window_ == window) | 360 if (capture_window_ == window) |
| 369 return; | 361 return; |
| 370 Window* lost_capture = capture_window_; | 362 Window* lost_capture = capture_window_; |
| 371 capture_window_ = window; | 363 capture_window_ = window; |
| 372 if (lost_capture) { | 364 if (lost_capture) { |
| 373 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(lost_capture).observers(), | 365 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(lost_capture).observers(), |
| 374 OnWindowLostCapture(lost_capture)); | 366 OnWindowLostCapture(lost_capture)); |
| 375 } | 367 } |
| 376 FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_, | 368 FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_, |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 if (!window) | 1085 if (!window) |
| 1094 return; | 1086 return; |
| 1095 | 1087 |
| 1096 InFlightPredefinedCursorChange new_change(window, cursor); | 1088 InFlightPredefinedCursorChange new_change(window, cursor); |
| 1097 if (ApplyServerChangeToExistingInFlightChange(new_change)) | 1089 if (ApplyServerChangeToExistingInFlightChange(new_change)) |
| 1098 return; | 1090 return; |
| 1099 | 1091 |
| 1100 WindowPrivate(window).LocalSetPredefinedCursor(cursor); | 1092 WindowPrivate(window).LocalSetPredefinedCursor(cursor); |
| 1101 } | 1093 } |
| 1102 | 1094 |
| 1103 void WindowTreeClient::OnWindowSurfaceChanged( | |
| 1104 Id window_id, | |
| 1105 const cc::SurfaceId& surface_id, | |
| 1106 const cc::SurfaceSequence& surface_sequence, | |
| 1107 const gfx::Size& frame_size, | |
| 1108 float device_scale_factor) { | |
| 1109 Window* window = GetWindowByServerId(window_id); | |
| 1110 if (!window) | |
| 1111 return; | |
| 1112 std::unique_ptr<SurfaceInfo> surface_info(base::MakeUnique<SurfaceInfo>()); | |
| 1113 surface_info->surface_id = surface_id; | |
| 1114 surface_info->surface_sequence = surface_sequence; | |
| 1115 surface_info->frame_size = frame_size; | |
| 1116 surface_info->device_scale_factor = device_scale_factor; | |
| 1117 WindowPrivate(window).LocalSetSurfaceId(std::move(surface_info)); | |
| 1118 } | |
| 1119 | |
| 1120 void WindowTreeClient::OnDragDropStart( | 1095 void WindowTreeClient::OnDragDropStart( |
| 1121 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { | 1096 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { |
| 1122 mime_drag_data_ = std::move(mime_data); | 1097 mime_drag_data_ = std::move(mime_data); |
| 1123 } | 1098 } |
| 1124 | 1099 |
| 1125 void WindowTreeClient::OnDragEnter(Id window_id, | 1100 void WindowTreeClient::OnDragEnter(Id window_id, |
| 1126 uint32_t key_state, | 1101 uint32_t key_state, |
| 1127 const gfx::Point& position, | 1102 const gfx::Point& position, |
| 1128 uint32_t effect_bitmask, | 1103 uint32_t effect_bitmask, |
| 1129 const OnDragEnterCallback& callback) { | 1104 const OnDragEnterCallback& callback) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 Window* window, | 1406 Window* window, |
| 1432 const gfx::Vector2d& offset, | 1407 const gfx::Vector2d& offset, |
| 1433 const gfx::Insets& hit_area) { | 1408 const gfx::Insets& hit_area) { |
| 1434 if (window_manager_internal_client_) { | 1409 if (window_manager_internal_client_) { |
| 1435 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1410 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 1436 server_id(window), offset.x(), offset.y(), hit_area); | 1411 server_id(window), offset.x(), offset.y(), hit_area); |
| 1437 } | 1412 } |
| 1438 } | 1413 } |
| 1439 | 1414 |
| 1440 } // namespace ui | 1415 } // namespace ui |
| OLD | NEW |