| 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/lib/window_tree_client_impl.h" | 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 Window* window = AddWindowToConnection( | 79 Window* window = AddWindowToConnection( |
| 80 client, !parents.empty() ? parents.back() : NULL, windows[i]); | 80 client, !parents.empty() ? parents.back() : NULL, windows[i]); |
| 81 if (!last_window) | 81 if (!last_window) |
| 82 root = window; | 82 root = window; |
| 83 last_window = window; | 83 last_window = window; |
| 84 } | 84 } |
| 85 return root; | 85 return root; |
| 86 } | 86 } |
| 87 | 87 |
| 88 WindowTreeConnection* WindowTreeConnection::Create(WindowTreeDelegate* delegate, | 88 WindowTreeConnection* WindowTreeConnection::Create( |
| 89 mojo::Connector* connector) { | 89 WindowTreeDelegate* delegate, |
| 90 shell::Connector* connector) { |
| 90 WindowTreeClientImpl* client = | 91 WindowTreeClientImpl* client = |
| 91 new WindowTreeClientImpl(delegate, nullptr, nullptr); | 92 new WindowTreeClientImpl(delegate, nullptr, nullptr); |
| 92 client->ConnectViaWindowTreeFactory(connector); | 93 client->ConnectViaWindowTreeFactory(connector); |
| 93 return client; | 94 return client; |
| 94 } | 95 } |
| 95 | 96 |
| 96 WindowTreeConnection* WindowTreeConnection::Create( | 97 WindowTreeConnection* WindowTreeConnection::Create( |
| 97 WindowTreeDelegate* delegate, | 98 WindowTreeDelegate* delegate, |
| 98 mojo::InterfaceRequest<mojom::WindowTreeClient> request, | 99 mojo::InterfaceRequest<mojom::WindowTreeClient> request, |
| 99 CreateType create_type) { | 100 CreateType create_type) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // exception is the window manager and embed roots, which may know about | 158 // exception is the window manager and embed roots, which may know about |
| 158 // other random windows that it doesn't own. | 159 // other random windows that it doesn't own. |
| 159 // NOTE: we manually delete as we're a friend. | 160 // NOTE: we manually delete as we're a friend. |
| 160 while (!tracker.windows().empty()) | 161 while (!tracker.windows().empty()) |
| 161 delete tracker.windows().front(); | 162 delete tracker.windows().front(); |
| 162 | 163 |
| 163 delegate_->OnConnectionLost(this); | 164 delegate_->OnConnectionLost(this); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void WindowTreeClientImpl::ConnectViaWindowTreeFactory( | 167 void WindowTreeClientImpl::ConnectViaWindowTreeFactory( |
| 167 mojo::Connector* connector) { | 168 shell::Connector* connector) { |
| 168 // Clients created with no root shouldn't delete automatically. | 169 // Clients created with no root shouldn't delete automatically. |
| 169 delete_on_no_roots_ = false; | 170 delete_on_no_roots_ = false; |
| 170 | 171 |
| 171 // The connection id doesn't really matter, we use 101 purely for debugging. | 172 // The connection id doesn't really matter, we use 101 purely for debugging. |
| 172 connection_id_ = 101; | 173 connection_id_ = 101; |
| 173 | 174 |
| 174 mojom::WindowTreeFactoryPtr factory; | 175 mojom::WindowTreeFactoryPtr factory; |
| 175 connector->ConnectToInterface("mojo:mus", &factory); | 176 connector->ConnectToInterface("mojo:mus", &factory); |
| 176 factory->CreateWindowTree(GetProxy(&tree_ptr_), | 177 factory->CreateWindowTree(GetProxy(&tree_ptr_), |
| 177 binding_.CreateInterfacePtrAndBind()); | 178 binding_.CreateInterfacePtrAndBind()); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1032 |
| 1032 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1033 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 1033 Window* window, | 1034 Window* window, |
| 1034 const gfx::Vector2d& offset, | 1035 const gfx::Vector2d& offset, |
| 1035 const gfx::Insets& hit_area) { | 1036 const gfx::Insets& hit_area) { |
| 1036 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1037 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
| 1037 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area)); | 1038 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area)); |
| 1038 } | 1039 } |
| 1039 | 1040 |
| 1040 } // namespace mus | 1041 } // namespace mus |
| OLD | NEW |