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> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 void WindowTreeClient::ConnectViaWindowTreeFactory( | 148 void WindowTreeClient::ConnectViaWindowTreeFactory( |
149 service_manager::Connector* connector) { | 149 service_manager::Connector* connector) { |
150 // The client id doesn't really matter, we use 101 purely for debugging. | 150 // The client id doesn't really matter, we use 101 purely for debugging. |
151 client_id_ = 101; | 151 client_id_ = 101; |
152 | 152 |
153 mojom::WindowTreeFactoryPtr factory; | 153 mojom::WindowTreeFactoryPtr factory; |
154 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); | 154 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); |
155 mojom::WindowTreePtr window_tree; | 155 mojom::WindowTreePtr window_tree; |
156 factory->CreateWindowTree(GetProxy(&window_tree), | 156 factory->CreateWindowTree(MakeRequest(&window_tree), |
157 binding_.CreateInterfacePtrAndBind()); | 157 binding_.CreateInterfacePtrAndBind()); |
158 SetWindowTree(std::move(window_tree)); | 158 SetWindowTree(std::move(window_tree)); |
159 } | 159 } |
160 | 160 |
161 void WindowTreeClient::ConnectAsWindowManager( | 161 void WindowTreeClient::ConnectAsWindowManager( |
162 service_manager::Connector* connector) { | 162 service_manager::Connector* connector) { |
163 DCHECK(window_manager_delegate_); | 163 DCHECK(window_manager_delegate_); |
164 | 164 |
165 mojom::WindowManagerWindowTreeFactoryPtr factory; | 165 mojom::WindowManagerWindowTreeFactoryPtr factory; |
166 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); | 166 connector->ConnectToInterface(ui::mojom::kServiceName, &factory); |
167 mojom::WindowTreePtr window_tree; | 167 mojom::WindowTreePtr window_tree; |
168 factory->CreateWindowTree(GetProxy(&window_tree), | 168 factory->CreateWindowTree(MakeRequest(&window_tree), |
169 binding_.CreateInterfacePtrAndBind()); | 169 binding_.CreateInterfacePtrAndBind()); |
170 SetWindowTree(std::move(window_tree)); | 170 SetWindowTree(std::move(window_tree)); |
171 } | 171 } |
172 | 172 |
173 void WindowTreeClient::WaitForEmbed() { | 173 void WindowTreeClient::WaitForEmbed() { |
174 DCHECK(roots_.empty()); | 174 DCHECK(roots_.empty()); |
175 // OnEmbed() is the first function called. | 175 // OnEmbed() is the first function called. |
176 binding_.WaitForIncomingMethodCall(); | 176 binding_.WaitForIncomingMethodCall(); |
177 // TODO(sky): deal with pipe being closed before we get OnEmbed(). | 177 // TODO(sky): deal with pipe being closed before we get OnEmbed(). |
178 } | 178 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 tree_ = tree_ptr_.get(); | 560 tree_ = tree_ptr_.get(); |
561 | 561 |
562 tree_ptr_->GetCursorLocationMemory( | 562 tree_ptr_->GetCursorLocationMemory( |
563 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, | 563 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, |
564 weak_factory_.GetWeakPtr())); | 564 weak_factory_.GetWeakPtr())); |
565 | 565 |
566 tree_ptr_.set_connection_error_handler(base::Bind( | 566 tree_ptr_.set_connection_error_handler(base::Bind( |
567 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); | 567 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); |
568 | 568 |
569 if (window_manager_delegate_) { | 569 if (window_manager_delegate_) { |
570 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, | 570 tree_ptr_->GetWindowManagerClient(MakeRequest( |
571 tree_ptr_.associated_group())); | 571 &window_manager_internal_client_, tree_ptr_.associated_group())); |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 void WindowTreeClient::OnConnectionLost() { | 575 void WindowTreeClient::OnConnectionLost() { |
576 delegate_->OnLostConnection(this); | 576 delegate_->OnLostConnection(this); |
577 } | 577 } |
578 | 578 |
579 void WindowTreeClient::OnEmbedImpl(mojom::WindowTree* window_tree, | 579 void WindowTreeClient::OnEmbedImpl(mojom::WindowTree* window_tree, |
580 ClientSpecificId client_id, | 580 ClientSpecificId client_id, |
581 mojom::WindowDataPtr root_data, | 581 mojom::WindowDataPtr root_data, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 mojom::WindowTreePtr tree, | 793 mojom::WindowTreePtr tree, |
794 int64_t display_id, | 794 int64_t display_id, |
795 Id focused_window_id, | 795 Id focused_window_id, |
796 bool drawn) { | 796 bool drawn) { |
797 DCHECK(!tree_ptr_); | 797 DCHECK(!tree_ptr_); |
798 tree_ptr_ = std::move(tree); | 798 tree_ptr_ = std::move(tree); |
799 | 799 |
800 is_from_embed_ = true; | 800 is_from_embed_ = true; |
801 | 801 |
802 if (window_manager_delegate_) { | 802 if (window_manager_delegate_) { |
803 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, | 803 tree_ptr_->GetWindowManagerClient(MakeRequest( |
804 tree_ptr_.associated_group())); | 804 &window_manager_internal_client_, tree_ptr_.associated_group())); |
805 } | 805 } |
806 | 806 |
807 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, | 807 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, |
808 focused_window_id, drawn); | 808 focused_window_id, drawn); |
809 } | 809 } |
810 | 810 |
811 void WindowTreeClient::OnEmbeddedAppDisconnected(Id window_id) { | 811 void WindowTreeClient::OnEmbeddedAppDisconnected(Id window_id) { |
812 Window* window = GetWindowByServerId(window_id); | 812 Window* window = GetWindowByServerId(window_id); |
813 if (window) { | 813 if (window) { |
814 for (auto& observer : *WindowPrivate(window).observers()) | 814 for (auto& observer : *WindowPrivate(window).observers()) |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 // TODO(riajiang): Figure out if |offset| needs to be converted. | 1477 // TODO(riajiang): Figure out if |offset| needs to be converted. |
1478 // (http://crbugs.com/646932) | 1478 // (http://crbugs.com/646932) |
1479 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1479 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
1480 server_id(window), offset.x(), offset.y(), | 1480 server_id(window), offset.x(), offset.y(), |
1481 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()), | 1481 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()), |
1482 hit_area)); | 1482 hit_area)); |
1483 } | 1483 } |
1484 } | 1484 } |
1485 | 1485 |
1486 } // namespace ui | 1486 } // namespace ui |
OLD | NEW |