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 "components/mus/public/cpp/window_tree_client.h" | 5 #include "components/mus/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 12 matching lines...) Expand all Loading... |
23 #include "components/mus/public/cpp/window_tree_client_observer.h" | 23 #include "components/mus/public/cpp/window_tree_client_observer.h" |
24 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo
jom.h" | 24 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo
jom.h" |
25 #include "services/shell/public/cpp/connector.h" | 25 #include "services/shell/public/cpp/connector.h" |
26 #include "ui/display/mojo/display_type_converters.h" | 26 #include "ui/display/mojo/display_type_converters.h" |
27 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
28 #include "ui/gfx/geometry/insets.h" | 28 #include "ui/gfx/geometry/insets.h" |
29 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
30 | 30 |
31 namespace mus { | 31 namespace mus { |
32 | 32 |
| 33 void DeleteWindowTreeClient(WindowTreeClient* client) { delete client; } |
| 34 |
33 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { | 35 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { |
34 return (client_id << 16) | local_id; | 36 return (client_id << 16) | local_id; |
35 } | 37 } |
36 | 38 |
37 Id server_id(Window* window) { | 39 Id server_id(Window* window) { |
38 return WindowPrivate(window).server_id(); | 40 return WindowPrivate(window).server_id(); |
39 } | 41 } |
40 | 42 |
41 // Helper called to construct a local window object from transport data. | 43 // Helper called to construct a local window object from transport data. |
42 Window* AddWindowToClient(WindowTreeClient* client, | 44 Window* AddWindowToClient(WindowTreeClient* client, |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 683 } |
682 | 684 |
683 void WindowTreeClient::OnEmbed(ClientSpecificId client_id, | 685 void WindowTreeClient::OnEmbed(ClientSpecificId client_id, |
684 mojom::WindowDataPtr root_data, | 686 mojom::WindowDataPtr root_data, |
685 mojom::WindowTreePtr tree, | 687 mojom::WindowTreePtr tree, |
686 int64_t display_id, | 688 int64_t display_id, |
687 Id focused_window_id, | 689 Id focused_window_id, |
688 bool drawn) { | 690 bool drawn) { |
689 DCHECK(!tree_ptr_); | 691 DCHECK(!tree_ptr_); |
690 tree_ptr_ = std::move(tree); | 692 tree_ptr_ = std::move(tree); |
691 tree_ptr_.set_connection_error_handler([this]() { delete this; }); | 693 tree_ptr_.set_connection_error_handler( |
| 694 base::Bind(&DeleteWindowTreeClient, this)); |
692 | 695 |
693 if (window_manager_delegate_) { | 696 if (window_manager_delegate_) { |
694 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, | 697 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, |
695 tree_ptr_.associated_group())); | 698 tree_ptr_.associated_group())); |
696 } | 699 } |
697 | 700 |
698 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, | 701 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, |
699 focused_window_id, drawn); | 702 focused_window_id, drawn); |
700 } | 703 } |
701 | 704 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 Window* window, | 1182 Window* window, |
1180 const gfx::Vector2d& offset, | 1183 const gfx::Vector2d& offset, |
1181 const gfx::Insets& hit_area) { | 1184 const gfx::Insets& hit_area) { |
1182 if (window_manager_internal_client_) { | 1185 if (window_manager_internal_client_) { |
1183 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1186 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
1184 server_id(window), offset.x(), offset.y(), hit_area); | 1187 server_id(window), offset.x(), offset.y(), hit_area); |
1185 } | 1188 } |
1186 } | 1189 } |
1187 | 1190 |
1188 } // namespace mus | 1191 } // namespace mus |
OLD | NEW |