| 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/service_manager/public/cpp/connector.h" | 15 #include "services/service_manager/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/surface_id_handler.h" |
| 20 #include "services/ui/public/cpp/window_drop_target.h" | 20 #include "services/ui/public/cpp/window_drop_target.h" |
| 21 #include "services/ui/public/cpp/window_manager_delegate.h" | 21 #include "services/ui/public/cpp/window_manager_delegate.h" |
| 22 #include "services/ui/public/cpp/window_observer.h" | 22 #include "services/ui/public/cpp/window_observer.h" |
| 23 #include "services/ui/public/cpp/window_private.h" | 23 #include "services/ui/public/cpp/window_private.h" |
| 24 #include "services/ui/public/cpp/window_tracker.h" | 24 #include "services/ui/public/cpp/window_tracker.h" |
| 25 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 25 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 26 #include "services/ui/public/cpp/window_tree_client_observer.h" | 26 #include "services/ui/public/cpp/window_tree_client_observer.h" |
| 27 #include "services/ui/public/interfaces/constants.mojom.h" |
| 27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 28 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
| 28 #include "ui/events/event.h" | 29 #include "ui/events/event.h" |
| 29 #include "ui/gfx/geometry/insets.h" | 30 #include "ui/gfx/geometry/insets.h" |
| 30 #include "ui/gfx/geometry/size.h" | 31 #include "ui/gfx/geometry/size.h" |
| 31 | 32 |
| 32 namespace ui { | 33 namespace ui { |
| 33 | 34 |
| 34 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { | 35 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { |
| 35 return (client_id << 16) | local_id; | 36 return (client_id << 16) | local_id; |
| 36 } | 37 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 for (auto& observer : observers_) | 118 for (auto& observer : observers_) |
| 118 observer.OnDidDestroyClient(this); | 119 observer.OnDidDestroyClient(this); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void WindowTreeClient::ConnectViaWindowTreeFactory( | 122 void WindowTreeClient::ConnectViaWindowTreeFactory( |
| 122 service_manager::Connector* connector) { | 123 service_manager::Connector* connector) { |
| 123 // The client id doesn't really matter, we use 101 purely for debugging. | 124 // The client id doesn't really matter, we use 101 purely for debugging. |
| 124 client_id_ = 101; | 125 client_id_ = 101; |
| 125 | 126 |
| 126 mojom::WindowTreeFactoryPtr factory; | 127 mojom::WindowTreeFactoryPtr factory; |
| 127 connector->ConnectToInterface("ui", &factory); | 128 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); |
| 128 mojom::WindowTreePtr window_tree; | 129 mojom::WindowTreePtr window_tree; |
| 129 factory->CreateWindowTree(GetProxy(&window_tree), | 130 factory->CreateWindowTree(GetProxy(&window_tree), |
| 130 binding_.CreateInterfacePtrAndBind()); | 131 binding_.CreateInterfacePtrAndBind()); |
| 131 SetWindowTree(std::move(window_tree)); | 132 SetWindowTree(std::move(window_tree)); |
| 132 } | 133 } |
| 133 | 134 |
| 134 void WindowTreeClient::ConnectAsWindowManager( | 135 void WindowTreeClient::ConnectAsWindowManager( |
| 135 service_manager::Connector* connector) { | 136 service_manager::Connector* connector) { |
| 136 DCHECK(window_manager_delegate_); | 137 DCHECK(window_manager_delegate_); |
| 137 | 138 |
| 138 mojom::WindowManagerWindowTreeFactoryPtr factory; | 139 mojom::WindowManagerWindowTreeFactoryPtr factory; |
| 139 connector->ConnectToInterface("ui", &factory); | 140 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); |
| 140 mojom::WindowTreePtr window_tree; | 141 mojom::WindowTreePtr window_tree; |
| 141 factory->CreateWindowTree(GetProxy(&window_tree), | 142 factory->CreateWindowTree(GetProxy(&window_tree), |
| 142 binding_.CreateInterfacePtrAndBind()); | 143 binding_.CreateInterfacePtrAndBind()); |
| 143 SetWindowTree(std::move(window_tree)); | 144 SetWindowTree(std::move(window_tree)); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void WindowTreeClient::WaitForEmbed() { | 147 void WindowTreeClient::WaitForEmbed() { |
| 147 DCHECK(roots_.empty()); | 148 DCHECK(roots_.empty()); |
| 148 // OnEmbed() is the first function called. | 149 // OnEmbed() is the first function called. |
| 149 binding_.WaitForIncomingMethodCall(); | 150 binding_.WaitForIncomingMethodCall(); |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 Window* window, | 1421 Window* window, |
| 1421 const gfx::Vector2d& offset, | 1422 const gfx::Vector2d& offset, |
| 1422 const gfx::Insets& hit_area) { | 1423 const gfx::Insets& hit_area) { |
| 1423 if (window_manager_internal_client_) { | 1424 if (window_manager_internal_client_) { |
| 1424 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1425 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 1425 server_id(window), offset.x(), offset.y(), hit_area); | 1426 server_id(window), offset.x(), offset.y(), hit_area); |
| 1426 } | 1427 } |
| 1427 } | 1428 } |
| 1428 | 1429 |
| 1429 } // namespace ui | 1430 } // namespace ui |
| OLD | NEW |