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 10 matching lines...) Expand all Loading... |
21 #include "components/mus/public/cpp/window_tracker.h" | 21 #include "components/mus/public/cpp/window_tracker.h" |
22 #include "components/mus/public/cpp/window_tree_client_delegate.h" | 22 #include "components/mus/public/cpp/window_tree_client_delegate.h" |
23 #include "components/mus/public/cpp/window_tree_client_observer.h" | 23 #include "components/mus/public/cpp/window_tree_client_observer.h" |
24 #include "services/shell/public/cpp/connector.h" | 24 #include "services/shell/public/cpp/connector.h" |
25 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
26 #include "ui/gfx/geometry/insets.h" | 26 #include "ui/gfx/geometry/insets.h" |
27 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
28 | 28 |
29 namespace mus { | 29 namespace mus { |
30 | 30 |
| 31 void DeleteWindowTreeClient(WindowTreeClient* client) { delete client; } |
| 32 |
31 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { | 33 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { |
32 return (client_id << 16) | local_id; | 34 return (client_id << 16) | local_id; |
33 } | 35 } |
34 | 36 |
35 Id server_id(Window* window) { | 37 Id server_id(Window* window) { |
36 return WindowPrivate(window).server_id(); | 38 return WindowPrivate(window).server_id(); |
37 } | 39 } |
38 | 40 |
39 // Helper called to construct a local window object from transport data. | 41 // Helper called to construct a local window object from transport data. |
40 Window* AddWindowToClient(WindowTreeClient* client, | 42 Window* AddWindowToClient(WindowTreeClient* client, |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 639 } |
638 | 640 |
639 void WindowTreeClient::OnEmbed(ClientSpecificId client_id, | 641 void WindowTreeClient::OnEmbed(ClientSpecificId client_id, |
640 mojom::WindowDataPtr root_data, | 642 mojom::WindowDataPtr root_data, |
641 mojom::WindowTreePtr tree, | 643 mojom::WindowTreePtr tree, |
642 int64_t display_id, | 644 int64_t display_id, |
643 Id focused_window_id, | 645 Id focused_window_id, |
644 bool drawn) { | 646 bool drawn) { |
645 DCHECK(!tree_ptr_); | 647 DCHECK(!tree_ptr_); |
646 tree_ptr_ = std::move(tree); | 648 tree_ptr_ = std::move(tree); |
647 tree_ptr_.set_connection_error_handler([this]() { delete this; }); | 649 tree_ptr_.set_connection_error_handler( |
| 650 base::Bind(&DeleteWindowTreeClient, this)); |
648 | 651 |
649 if (window_manager_delegate_) { | 652 if (window_manager_delegate_) { |
650 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, | 653 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, |
651 tree_ptr_.associated_group())); | 654 tree_ptr_.associated_group())); |
652 } | 655 } |
653 | 656 |
654 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, | 657 OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id, |
655 focused_window_id, drawn); | 658 focused_window_id, drawn); |
656 } | 659 } |
657 | 660 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 Window* window, | 1127 Window* window, |
1125 const gfx::Vector2d& offset, | 1128 const gfx::Vector2d& offset, |
1126 const gfx::Insets& hit_area) { | 1129 const gfx::Insets& hit_area) { |
1127 if (window_manager_internal_client_) { | 1130 if (window_manager_internal_client_) { |
1128 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1131 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
1129 server_id(window), offset.x(), offset.y(), hit_area); | 1132 server_id(window), offset.x(), offset.y(), hit_area); |
1130 } | 1133 } |
1131 } | 1134 } |
1132 | 1135 |
1133 } // namespace mus | 1136 } // namespace mus |
OLD | NEW |