Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2414683003: Mus+Ash: propagate Surface ID to parents (Closed)
Patch Set: Don't follow null surface_info Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
19 #include "services/ui/public/cpp/window_drop_target.h" 20 #include "services/ui/public/cpp/window_drop_target.h"
20 #include "services/ui/public/cpp/window_manager_delegate.h" 21 #include "services/ui/public/cpp/window_manager_delegate.h"
21 #include "services/ui/public/cpp/window_observer.h" 22 #include "services/ui/public/cpp/window_observer.h"
22 #include "services/ui/public/cpp/window_private.h" 23 #include "services/ui/public/cpp/window_private.h"
23 #include "services/ui/public/cpp/window_tracker.h" 24 #include "services/ui/public/cpp/window_tracker.h"
24 #include "services/ui/public/cpp/window_tree_client_delegate.h" 25 #include "services/ui/public/cpp/window_tree_client_delegate.h"
25 #include "services/ui/public/cpp/window_tree_client_observer.h" 26 #include "services/ui/public/cpp/window_tree_client_observer.h"
26 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" 27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h"
27 #include "ui/events/event.h" 28 #include "ui/events/event.h"
28 #include "ui/gfx/geometry/insets.h" 29 #include "ui/gfx/geometry/insets.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 350
350 void WindowTreeClient::AttachSurface( 351 void WindowTreeClient::AttachSurface(
351 Id window_id, 352 Id window_id,
352 mojom::SurfaceType type, 353 mojom::SurfaceType type,
353 mojo::InterfaceRequest<mojom::Surface> surface, 354 mojo::InterfaceRequest<mojom::Surface> surface,
354 mojom::SurfaceClientPtr client) { 355 mojom::SurfaceClientPtr client) {
355 DCHECK(tree_); 356 DCHECK(tree_);
356 tree_->AttachSurface(window_id, type, std::move(surface), std::move(client)); 357 tree_->AttachSurface(window_id, type, std::move(surface), std::move(client));
357 } 358 }
358 359
360 void WindowTreeClient::OnWindowSurfaceDetached(
361 Id window_id,
362 const cc::SurfaceSequence& sequence) {
363 DCHECK(tree_);
364 tree_->OnWindowSurfaceDetached(window_id, sequence);
365 }
366
359 void WindowTreeClient::LocalSetCapture(Window* window) { 367 void WindowTreeClient::LocalSetCapture(Window* window) {
360 if (capture_window_ == window) 368 if (capture_window_ == window)
361 return; 369 return;
362 Window* lost_capture = capture_window_; 370 Window* lost_capture = capture_window_;
363 capture_window_ = window; 371 capture_window_ = window;
364 if (lost_capture) { 372 if (lost_capture) {
365 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(lost_capture).observers(), 373 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(lost_capture).observers(),
366 OnWindowLostCapture(lost_capture)); 374 OnWindowLostCapture(lost_capture));
367 } 375 }
368 FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_, 376 FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 if (!window) 1093 if (!window)
1086 return; 1094 return;
1087 1095
1088 InFlightPredefinedCursorChange new_change(window, cursor); 1096 InFlightPredefinedCursorChange new_change(window, cursor);
1089 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1097 if (ApplyServerChangeToExistingInFlightChange(new_change))
1090 return; 1098 return;
1091 1099
1092 WindowPrivate(window).LocalSetPredefinedCursor(cursor); 1100 WindowPrivate(window).LocalSetPredefinedCursor(cursor);
1093 } 1101 }
1094 1102
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
1095 void WindowTreeClient::OnDragDropStart( 1120 void WindowTreeClient::OnDragDropStart(
1096 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { 1121 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) {
1097 mime_drag_data_ = std::move(mime_data); 1122 mime_drag_data_ = std::move(mime_data);
1098 } 1123 }
1099 1124
1100 void WindowTreeClient::OnDragEnter(Id window_id, 1125 void WindowTreeClient::OnDragEnter(Id window_id,
1101 uint32_t key_state, 1126 uint32_t key_state,
1102 const gfx::Point& position, 1127 const gfx::Point& position,
1103 uint32_t effect_bitmask, 1128 uint32_t effect_bitmask,
1104 const OnDragEnterCallback& callback) { 1129 const OnDragEnterCallback& callback) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 Window* window, 1431 Window* window,
1407 const gfx::Vector2d& offset, 1432 const gfx::Vector2d& offset,
1408 const gfx::Insets& hit_area) { 1433 const gfx::Insets& hit_area) {
1409 if (window_manager_internal_client_) { 1434 if (window_manager_internal_client_) {
1410 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1435 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1411 server_id(window), offset.x(), offset.y(), hit_area); 1436 server_id(window), offset.x(), offset.y(), hit_area);
1412 } 1437 }
1413 } 1438 }
1414 1439
1415 } // namespace ui 1440 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/window_tree_client.h ('k') | services/ui/public/interfaces/window_tree.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698