Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: components/mus/public/cpp/lib/window_tree_client_impl.cc

Issue 1725353003: Eliminate mojo::Shell client lib class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@15connector
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/mus/common/util.h" 11 #include "components/mus/common/util.h"
12 #include "components/mus/public/cpp/input_event_handler.h" 12 #include "components/mus/public/cpp/input_event_handler.h"
13 #include "components/mus/public/cpp/lib/in_flight_change.h" 13 #include "components/mus/public/cpp/lib/in_flight_change.h"
14 #include "components/mus/public/cpp/lib/window_private.h" 14 #include "components/mus/public/cpp/lib/window_private.h"
15 #include "components/mus/public/cpp/window_manager_delegate.h" 15 #include "components/mus/public/cpp/window_manager_delegate.h"
16 #include "components/mus/public/cpp/window_observer.h" 16 #include "components/mus/public/cpp/window_observer.h"
17 #include "components/mus/public/cpp/window_tracker.h" 17 #include "components/mus/public/cpp/window_tracker.h"
18 #include "components/mus/public/cpp/window_tree_connection.h" 18 #include "components/mus/public/cpp/window_tree_connection.h"
19 #include "components/mus/public/cpp/window_tree_connection_observer.h" 19 #include "components/mus/public/cpp/window_tree_connection_observer.h"
20 #include "components/mus/public/cpp/window_tree_delegate.h" 20 #include "components/mus/public/cpp/window_tree_delegate.h"
21 #include "mojo/converters/geometry/geometry_type_converters.h" 21 #include "mojo/converters/geometry/geometry_type_converters.h"
22 #include "mojo/shell/public/cpp/shell.h" 22 #include "mojo/shell/public/cpp/connector.h"
23 #include "ui/gfx/geometry/insets.h" 23 #include "ui/gfx/geometry/insets.h"
24 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
25 25
26 namespace mus { 26 namespace mus {
27 27
28 Id MakeTransportId(ConnectionSpecificId connection_id, 28 Id MakeTransportId(ConnectionSpecificId connection_id,
29 ConnectionSpecificId local_id) { 29 ConnectionSpecificId local_id) {
30 return (connection_id << 16) | local_id; 30 return (connection_id << 16) | local_id;
31 } 31 }
32 32
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 Window* window = AddWindowToConnection( 73 Window* window = AddWindowToConnection(
74 client, !parents.empty() ? parents.back() : NULL, windows[i]); 74 client, !parents.empty() ? parents.back() : NULL, windows[i]);
75 if (!last_window) 75 if (!last_window)
76 root = window; 76 root = window;
77 last_window = window; 77 last_window = window;
78 } 78 }
79 return root; 79 return root;
80 } 80 }
81 81
82 WindowTreeConnection* WindowTreeConnection::Create(WindowTreeDelegate* delegate, 82 WindowTreeConnection* WindowTreeConnection::Create(WindowTreeDelegate* delegate,
83 mojo::Shell* shell) { 83 mojo::Connector* connector) {
84 WindowTreeClientImpl* client = 84 WindowTreeClientImpl* client =
85 new WindowTreeClientImpl(delegate, nullptr, nullptr); 85 new WindowTreeClientImpl(delegate, nullptr, nullptr);
86 client->ConnectViaWindowTreeFactory(shell); 86 client->ConnectViaWindowTreeFactory(connector);
87 return client; 87 return client;
88 } 88 }
89 89
90 WindowTreeConnection* WindowTreeConnection::Create( 90 WindowTreeConnection* WindowTreeConnection::Create(
91 WindowTreeDelegate* delegate, 91 WindowTreeDelegate* delegate,
92 mojo::InterfaceRequest<mojom::WindowTreeClient> request, 92 mojo::InterfaceRequest<mojom::WindowTreeClient> request,
93 CreateType create_type) { 93 CreateType create_type) {
94 WindowTreeClientImpl* client = 94 WindowTreeClientImpl* client =
95 new WindowTreeClientImpl(delegate, nullptr, std::move(request)); 95 new WindowTreeClientImpl(delegate, nullptr, std::move(request));
96 if (create_type == CreateType::WAIT_FOR_EMBED) 96 if (create_type == CreateType::WAIT_FOR_EMBED)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // exception is the window manager and embed roots, which may know about 152 // exception is the window manager and embed roots, which may know about
153 // other random windows that it doesn't own. 153 // other random windows that it doesn't own.
154 // NOTE: we manually delete as we're a friend. 154 // NOTE: we manually delete as we're a friend.
155 while (!tracker.windows().empty()) 155 while (!tracker.windows().empty())
156 delete tracker.windows().front(); 156 delete tracker.windows().front();
157 157
158 delegate_->OnConnectionLost(this); 158 delegate_->OnConnectionLost(this);
159 } 159 }
160 160
161 void WindowTreeClientImpl::ConnectViaWindowTreeFactory( 161 void WindowTreeClientImpl::ConnectViaWindowTreeFactory(
162 mojo::Shell* shell) { 162 mojo::Connector* connector) {
163 // Clients created with no root shouldn't delete automatically. 163 // Clients created with no root shouldn't delete automatically.
164 delete_on_no_roots_ = false; 164 delete_on_no_roots_ = false;
165 165
166 // The connection id doesn't really matter, we use 101 purely for debugging. 166 // The connection id doesn't really matter, we use 101 purely for debugging.
167 connection_id_ = 101; 167 connection_id_ = 101;
168 168
169 mojom::WindowTreeFactoryPtr factory; 169 mojom::WindowTreeFactoryPtr factory;
170 shell->ConnectToInterface("mojo:mus", &factory); 170 connector->ConnectToInterface("mojo:mus", &factory);
171 factory->CreateWindowTree(GetProxy(&tree_ptr_), 171 factory->CreateWindowTree(GetProxy(&tree_ptr_),
172 binding_.CreateInterfacePtrAndBind()); 172 binding_.CreateInterfacePtrAndBind());
173 tree_ = tree_ptr_.get(); 173 tree_ = tree_ptr_.get();
174 } 174 }
175 175
176 void WindowTreeClientImpl::WaitForEmbed() { 176 void WindowTreeClientImpl::WaitForEmbed() {
177 DCHECK(roots_.empty()); 177 DCHECK(roots_.empty());
178 // OnEmbed() is the first function called. 178 // OnEmbed() is the first function called.
179 binding_.WaitForIncomingMethodCall(); 179 binding_.WaitForIncomingMethodCall();
180 // TODO(sky): deal with pipe being closed before we get OnEmbed(). 180 // TODO(sky): deal with pipe being closed before we get OnEmbed().
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 979
980 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( 980 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
981 Window* window, 981 Window* window,
982 const gfx::Vector2d& offset, 982 const gfx::Vector2d& offset,
983 const gfx::Insets& hit_area) { 983 const gfx::Insets& hit_area) {
984 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 984 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
985 window->id(), offset.x(), offset.y(), mojo::Insets::From(hit_area)); 985 window->id(), offset.x(), offset.y(), mojo::Insets::From(hit_area));
986 } 986 }
987 987
988 } // namespace mus 988 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/window_tree_client_impl.h ('k') | components/mus/public/cpp/lib/window_tree_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698