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 "mojo/services/view_manager/connection_manager.h" | 5 #include "mojo/services/view_manager/connection_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/input_events/input_events_type_converters.h" | 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
11 #include "mojo/public/cpp/application/application_connection.h" | 11 #include "mojo/public/cpp/application/application_connection.h" |
12 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 12 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 13 #include "mojo/services/view_manager/client_connection.h" |
13 #include "mojo/services/view_manager/connection_manager_delegate.h" | 14 #include "mojo/services/view_manager/connection_manager_delegate.h" |
14 #include "mojo/services/view_manager/view_manager_service_impl.h" | 15 #include "mojo/services/view_manager/view_manager_service_impl.h" |
15 | 16 |
16 namespace mojo { | 17 namespace mojo { |
17 namespace service { | 18 namespace service { |
18 | 19 |
19 class WindowManagerInternalClientImpl | 20 class WindowManagerInternalClientImpl |
20 : public InterfaceImpl<WindowManagerInternalClient> { | 21 : public InterfaceImpl<WindowManagerInternalClient> { |
21 public: | 22 public: |
22 WindowManagerInternalClientImpl(WindowManagerInternalClient* real_client, | 23 explicit WindowManagerInternalClientImpl( |
23 ErrorHandler* error_handler) | 24 WindowManagerInternalClient* real_client) |
24 : real_client_(real_client), error_handler_(error_handler) {} | 25 : real_client_(real_client) {} |
25 ~WindowManagerInternalClientImpl() override {} | 26 ~WindowManagerInternalClientImpl() override {} |
26 | 27 |
27 // WindowManagerInternalClient: | 28 // WindowManagerInternalClient: |
28 void DispatchInputEventToView(Id transport_view_id, EventPtr event) override { | 29 void DispatchInputEventToView(Id transport_view_id, EventPtr event) override { |
29 real_client_->DispatchInputEventToView(transport_view_id, event.Pass()); | 30 real_client_->DispatchInputEventToView(transport_view_id, event.Pass()); |
30 } | 31 } |
31 | 32 |
32 void SetViewportSize(SizePtr size) override { | 33 void SetViewportSize(SizePtr size) override { |
33 real_client_->SetViewportSize(size.Pass()); | 34 real_client_->SetViewportSize(size.Pass()); |
34 } | 35 } |
35 | 36 |
36 // InterfaceImpl: | 37 // TODO(sky): ErrorHandling temporarily nuked. Will be fixed shortly. |
37 void OnConnectionError() override { error_handler_->OnConnectionError(); } | |
38 | 38 |
39 private: | 39 private: |
40 WindowManagerInternalClient* real_client_; | 40 WindowManagerInternalClient* real_client_; |
41 ErrorHandler* error_handler_; | |
42 | 41 |
43 DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl); | 42 DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl); |
44 }; | 43 }; |
45 | 44 |
46 ConnectionManager::ScopedChange::ScopedChange( | 45 ConnectionManager::ScopedChange::ScopedChange( |
47 ViewManagerServiceImpl* connection, | 46 ViewManagerServiceImpl* connection, |
48 ConnectionManager* connection_manager, | 47 ConnectionManager* connection_manager, |
49 bool is_delete_view) | 48 bool is_delete_view) |
50 : connection_manager_(connection_manager), | 49 : connection_manager_(connection_manager), |
51 connection_id_(connection->id()), | 50 connection_id_(connection->id()), |
52 is_delete_view_(is_delete_view) { | 51 is_delete_view_(is_delete_view) { |
53 connection_manager_->PrepareForChange(this); | 52 connection_manager_->PrepareForChange(this); |
54 } | 53 } |
55 | 54 |
56 ConnectionManager::ScopedChange::~ScopedChange() { | 55 ConnectionManager::ScopedChange::~ScopedChange() { |
57 connection_manager_->FinishChange(); | 56 connection_manager_->FinishChange(); |
58 } | 57 } |
59 | 58 |
60 ConnectionManager::ConnectionManager(ApplicationConnection* app_connection, | 59 ConnectionManager::ConnectionManager(ApplicationConnection* app_connection, |
61 ConnectionManagerDelegate* delegate) | 60 ConnectionManagerDelegate* delegate) |
62 : app_connection_(app_connection), | 61 : app_connection_(app_connection), |
63 delegate_(delegate), | 62 delegate_(delegate), |
64 window_manager_vm_service_(nullptr), | 63 window_manager_client_connection_(nullptr), |
65 next_connection_id_(1), | 64 next_connection_id_(1), |
66 display_manager_( | 65 display_manager_( |
67 app_connection, | 66 app_connection, |
68 this, | 67 this, |
69 base::Bind(&ConnectionManagerDelegate::OnNativeViewportDestroyed, | 68 base::Bind(&ConnectionManagerDelegate::OnNativeViewportDestroyed, |
70 base::Unretained(delegate))), | 69 base::Unretained(delegate))), |
71 root_(new ServerView(this, RootViewId())), | 70 root_(new ServerView(this, RootViewId())), |
72 current_change_(NULL), | 71 current_change_(NULL), |
73 in_destructor_(false) { | 72 in_destructor_(false) { |
74 // |app_connection| originates from the WindowManager. Let it connect | 73 // |app_connection| originates from the WindowManager. Let it connect |
(...skipping 14 matching lines...) Expand all Loading... |
89 DCHECK(connection_map_.empty()); | 88 DCHECK(connection_map_.empty()); |
90 root_.reset(); | 89 root_.reset(); |
91 } | 90 } |
92 | 91 |
93 ConnectionSpecificId ConnectionManager::GetAndAdvanceNextConnectionId() { | 92 ConnectionSpecificId ConnectionManager::GetAndAdvanceNextConnectionId() { |
94 const ConnectionSpecificId id = next_connection_id_++; | 93 const ConnectionSpecificId id = next_connection_id_++; |
95 DCHECK_LT(id, next_connection_id_); | 94 DCHECK_LT(id, next_connection_id_); |
96 return id; | 95 return id; |
97 } | 96 } |
98 | 97 |
99 void ConnectionManager::OnConnectionError(ViewManagerServiceImpl* connection) { | 98 void ConnectionManager::OnConnectionError(ClientConnection* connection) { |
100 if (connection == window_manager_vm_service_) { | 99 if (connection == window_manager_client_connection_) { |
101 window_manager_vm_service_ = nullptr; | 100 window_manager_client_connection_ = nullptr; |
102 delegate_->OnLostConnectionToWindowManager(); | 101 delegate_->OnLostConnectionToWindowManager(); |
103 // Assume we've been destroyed. | 102 // Assume we've been destroyed. |
104 return; | 103 return; |
105 } | 104 } |
106 | 105 |
107 scoped_ptr<ViewManagerServiceImpl> connection_owner(connection); | 106 scoped_ptr<ClientConnection> connection_owner(connection); |
108 | 107 |
109 connection_map_.erase(connection->id()); | 108 connection_map_.erase(connection->service()->id()); |
110 | 109 |
111 // Notify remaining connections so that they can cleanup. | 110 // Notify remaining connections so that they can cleanup. |
112 for (ConnectionMap::const_iterator i = connection_map_.begin(); | 111 for (auto& pair : connection_map_) { |
113 i != connection_map_.end(); | 112 pair.second->service()->OnWillDestroyViewManagerServiceImpl( |
114 ++i) { | 113 connection->service()); |
115 i->second->OnWillDestroyViewManagerServiceImpl(connection); | |
116 } | 114 } |
117 } | 115 } |
118 | 116 |
119 void ConnectionManager::EmbedAtView( | 117 void ConnectionManager::EmbedAtView( |
120 ConnectionSpecificId creator_id, | 118 ConnectionSpecificId creator_id, |
121 const String& url, | 119 const String& url, |
122 Id transport_view_id, | 120 Id transport_view_id, |
123 InterfaceRequest<ServiceProvider> service_provider) { | 121 InterfaceRequest<ServiceProvider> service_provider) { |
| 122 std::string creator_url; |
| 123 ConnectionMap::const_iterator it = connection_map_.find(creator_id); |
| 124 if (it != connection_map_.end()) |
| 125 creator_url = it->second->service()->url(); |
| 126 |
124 MessagePipe pipe; | 127 MessagePipe pipe; |
125 | 128 |
126 ServiceProvider* view_manager_service_provider = | 129 ServiceProvider* view_manager_service_provider = |
127 app_connection_->ConnectToApplication(url)->GetServiceProvider(); | 130 app_connection_->ConnectToApplication(url)->GetServiceProvider(); |
128 | |
129 view_manager_service_provider->ConnectToService( | 131 view_manager_service_provider->ConnectToService( |
130 ViewManagerServiceImpl::Client::Name_, pipe.handle1.Pass()); | 132 ViewManagerServiceImpl::Client::Name_, pipe.handle1.Pass()); |
131 | 133 scoped_ptr<ViewManagerServiceImpl> service( |
132 std::string creator_url; | 134 new ViewManagerServiceImpl(this, creator_id, creator_url, url, |
133 ConnectionMap::const_iterator it = connection_map_.find(creator_id); | 135 ViewIdFromTransportId(transport_view_id))); |
134 if (it != connection_map_.end()) | 136 DefaultClientConnection* client_connection = |
135 creator_url = it->second->url(); | 137 new DefaultClientConnection(this, service.Pass()); |
136 | 138 client_connection->binding()->Bind(pipe.handle0.Pass()); |
137 ViewManagerServiceImpl* connection = | 139 client_connection->SetClient(); |
138 new ViewManagerServiceImpl(this, | 140 AddConnection(client_connection); |
139 creator_id, | 141 client_connection->service()->Init(client_connection->client(), |
140 creator_url, | 142 service_provider.Pass()); |
141 url.To<std::string>(), | 143 OnConnectionMessagedClient(client_connection->service()->id()); |
142 ViewIdFromTransportId(transport_view_id)); | |
143 AddConnection(connection); | |
144 WeakBindToPipe(connection, pipe.handle0.Pass()); | |
145 connection->Init(service_provider.Pass()); | |
146 OnConnectionMessagedClient(connection->id()); | |
147 } | 144 } |
148 | 145 |
149 ViewManagerServiceImpl* ConnectionManager::GetConnection( | 146 ViewManagerServiceImpl* ConnectionManager::GetConnection( |
150 ConnectionSpecificId connection_id) { | 147 ConnectionSpecificId connection_id) { |
151 ConnectionMap::iterator i = connection_map_.find(connection_id); | 148 ConnectionMap::iterator i = connection_map_.find(connection_id); |
152 return i == connection_map_.end() ? NULL : i->second; | 149 return i == connection_map_.end() ? nullptr : i->second->service(); |
153 } | 150 } |
154 | 151 |
155 ServerView* ConnectionManager::GetView(const ViewId& id) { | 152 ServerView* ConnectionManager::GetView(const ViewId& id) { |
156 if (id == root_->id()) | 153 if (id == root_->id()) |
157 return root_.get(); | 154 return root_.get(); |
158 ConnectionMap::iterator i = connection_map_.find(id.connection_id); | 155 ViewManagerServiceImpl* service = GetConnection(id.connection_id); |
159 return i == connection_map_.end() ? NULL : i->second->GetView(id); | 156 return service ? service->GetView(id) : nullptr; |
160 } | 157 } |
161 | 158 |
162 void ConnectionManager::OnConnectionMessagedClient(ConnectionSpecificId id) { | 159 void ConnectionManager::OnConnectionMessagedClient(ConnectionSpecificId id) { |
163 if (current_change_) | 160 if (current_change_) |
164 current_change_->MarkConnectionAsMessaged(id); | 161 current_change_->MarkConnectionAsMessaged(id); |
165 } | 162 } |
166 | 163 |
167 bool ConnectionManager::DidConnectionMessageClient( | 164 bool ConnectionManager::DidConnectionMessageClient( |
168 ConnectionSpecificId id) const { | 165 ConnectionSpecificId id) const { |
169 return current_change_ && current_change_->DidMessageConnection(id); | 166 return current_change_ && current_change_->DidMessageConnection(id); |
170 } | 167 } |
171 | 168 |
172 const ViewManagerServiceImpl* ConnectionManager::GetConnectionWithRoot( | 169 const ViewManagerServiceImpl* ConnectionManager::GetConnectionWithRoot( |
173 const ViewId& id) const { | 170 const ViewId& id) const { |
174 for (ConnectionMap::const_iterator i = connection_map_.begin(); | 171 for (auto& pair : connection_map_) { |
175 i != connection_map_.end(); | 172 if (pair.second->service()->IsRoot(id)) |
176 ++i) { | 173 return pair.second->service(); |
177 if (i->second->IsRoot(id)) | |
178 return i->second; | |
179 } | 174 } |
180 return NULL; | 175 return nullptr; |
181 } | 176 } |
182 | 177 |
183 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view, | 178 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view, |
184 const gfx::Rect& old_bounds, | 179 const gfx::Rect& old_bounds, |
185 const gfx::Rect& new_bounds) { | 180 const gfx::Rect& new_bounds) { |
186 for (ConnectionMap::iterator i = connection_map_.begin(); | 181 for (auto& pair : connection_map_) { |
187 i != connection_map_.end(); | 182 pair.second->service()->ProcessViewBoundsChanged( |
188 ++i) { | 183 view, old_bounds, new_bounds, IsChangeSource(pair.first)); |
189 i->second->ProcessViewBoundsChanged( | |
190 view, old_bounds, new_bounds, IsChangeSource(i->first)); | |
191 } | 184 } |
192 } | 185 } |
193 | 186 |
194 void ConnectionManager::ProcessWillChangeViewHierarchy( | 187 void ConnectionManager::ProcessWillChangeViewHierarchy( |
195 const ServerView* view, | 188 const ServerView* view, |
196 const ServerView* new_parent, | 189 const ServerView* new_parent, |
197 const ServerView* old_parent) { | 190 const ServerView* old_parent) { |
198 for (ConnectionMap::iterator i = connection_map_.begin(); | 191 for (auto& pair : connection_map_) { |
199 i != connection_map_.end(); | 192 pair.second->service()->ProcessWillChangeViewHierarchy( |
200 ++i) { | 193 view, new_parent, old_parent, IsChangeSource(pair.first)); |
201 i->second->ProcessWillChangeViewHierarchy( | |
202 view, new_parent, old_parent, IsChangeSource(i->first)); | |
203 } | 194 } |
204 } | 195 } |
205 | 196 |
206 void ConnectionManager::ProcessViewHierarchyChanged( | 197 void ConnectionManager::ProcessViewHierarchyChanged( |
207 const ServerView* view, | 198 const ServerView* view, |
208 const ServerView* new_parent, | 199 const ServerView* new_parent, |
209 const ServerView* old_parent) { | 200 const ServerView* old_parent) { |
210 for (ConnectionMap::iterator i = connection_map_.begin(); | 201 for (auto& pair : connection_map_) { |
211 i != connection_map_.end(); | 202 pair.second->service()->ProcessViewHierarchyChanged( |
212 ++i) { | 203 view, new_parent, old_parent, IsChangeSource(pair.first)); |
213 i->second->ProcessViewHierarchyChanged( | |
214 view, new_parent, old_parent, IsChangeSource(i->first)); | |
215 } | 204 } |
216 } | 205 } |
217 | 206 |
218 void ConnectionManager::ProcessViewReorder(const ServerView* view, | 207 void ConnectionManager::ProcessViewReorder(const ServerView* view, |
219 const ServerView* relative_view, | 208 const ServerView* relative_view, |
220 const OrderDirection direction) { | 209 const OrderDirection direction) { |
221 for (ConnectionMap::iterator i = connection_map_.begin(); | 210 for (auto& pair : connection_map_) { |
222 i != connection_map_.end(); | 211 pair.second->service()->ProcessViewReorder(view, relative_view, direction, |
223 ++i) { | 212 IsChangeSource(pair.first)); |
224 i->second->ProcessViewReorder( | |
225 view, relative_view, direction, IsChangeSource(i->first)); | |
226 } | 213 } |
227 } | 214 } |
228 | 215 |
229 void ConnectionManager::ProcessViewDeleted(const ViewId& view) { | 216 void ConnectionManager::ProcessViewDeleted(const ViewId& view) { |
230 for (ConnectionMap::iterator i = connection_map_.begin(); | 217 for (auto& pair : connection_map_) { |
231 i != connection_map_.end(); | 218 pair.second->service()->ProcessViewDeleted(view, |
232 ++i) { | 219 IsChangeSource(pair.first)); |
233 i->second->ProcessViewDeleted(view, IsChangeSource(i->first)); | |
234 } | 220 } |
235 } | 221 } |
236 | 222 |
237 void ConnectionManager::PrepareForChange(ScopedChange* change) { | 223 void ConnectionManager::PrepareForChange(ScopedChange* change) { |
238 // Should only ever have one change in flight. | 224 // Should only ever have one change in flight. |
239 CHECK(!current_change_); | 225 CHECK(!current_change_); |
240 current_change_ = change; | 226 current_change_ = change; |
241 } | 227 } |
242 | 228 |
243 void ConnectionManager::FinishChange() { | 229 void ConnectionManager::FinishChange() { |
244 // PrepareForChange/FinishChange should be balanced. | 230 // PrepareForChange/FinishChange should be balanced. |
245 CHECK(current_change_); | 231 CHECK(current_change_); |
246 current_change_ = NULL; | 232 current_change_ = NULL; |
247 } | 233 } |
248 | 234 |
249 void ConnectionManager::AddConnection(ViewManagerServiceImpl* connection) { | 235 void ConnectionManager::AddConnection(ClientConnection* connection) { |
250 DCHECK_EQ(0u, connection_map_.count(connection->id())); | 236 DCHECK_EQ(0u, connection_map_.count(connection->service()->id())); |
251 connection_map_[connection->id()] = connection; | 237 connection_map_[connection->service()->id()] = connection; |
252 } | 238 } |
253 | 239 |
254 void ConnectionManager::OnViewDestroyed(const ServerView* view) { | 240 void ConnectionManager::OnViewDestroyed(const ServerView* view) { |
255 if (!in_destructor_) | 241 if (!in_destructor_) |
256 ProcessViewDeleted(view->id()); | 242 ProcessViewDeleted(view->id()); |
257 } | 243 } |
258 | 244 |
259 void ConnectionManager::OnWillChangeViewHierarchy( | 245 void ConnectionManager::OnWillChangeViewHierarchy( |
260 const ServerView* view, | 246 const ServerView* view, |
261 const ServerView* new_parent, | 247 const ServerView* new_parent, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 const ServerView* relative, | 293 const ServerView* relative, |
308 OrderDirection direction) { | 294 OrderDirection direction) { |
309 if (!in_destructor_) | 295 if (!in_destructor_) |
310 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); | 296 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); |
311 } | 297 } |
312 | 298 |
313 void ConnectionManager::OnWillChangeViewVisibility(const ServerView* view) { | 299 void ConnectionManager::OnWillChangeViewVisibility(const ServerView* view) { |
314 if (in_destructor_) | 300 if (in_destructor_) |
315 return; | 301 return; |
316 | 302 |
317 for (ConnectionMap::iterator i = connection_map_.begin(); | 303 for (auto& pair : connection_map_) { |
318 i != connection_map_.end(); | 304 pair.second->service()->ProcessWillChangeViewVisibility( |
319 ++i) { | 305 view, IsChangeSource(pair.first)); |
320 i->second->ProcessWillChangeViewVisibility(view, IsChangeSource(i->first)); | |
321 } | 306 } |
322 } | 307 } |
323 | 308 |
324 void ConnectionManager::OnViewPropertyChanged( | 309 void ConnectionManager::OnViewPropertyChanged( |
325 const ServerView* view, | 310 const ServerView* view, |
326 const std::string& name, | 311 const std::string& name, |
327 const std::vector<uint8_t>* new_data) { | 312 const std::vector<uint8_t>* new_data) { |
328 for (auto& pair : connection_map_) { | 313 for (auto& pair : connection_map_) { |
329 pair.second->ProcessViewPropertyChanged( | 314 pair.second->service()->ProcessViewPropertyChanged( |
330 view, name, new_data, IsChangeSource(pair.first)); | 315 view, name, new_data, IsChangeSource(pair.first)); |
331 } | 316 } |
332 } | 317 } |
333 | 318 |
334 void ConnectionManager::SetViewportSize(SizePtr size) { | 319 void ConnectionManager::SetViewportSize(SizePtr size) { |
335 gfx::Size new_size = size.To<gfx::Size>(); | 320 gfx::Size new_size = size.To<gfx::Size>(); |
336 display_manager_.SetViewportSize(new_size); | 321 display_manager_.SetViewportSize(new_size); |
337 } | 322 } |
338 | 323 |
339 void ConnectionManager::DispatchInputEventToView(Id transport_view_id, | 324 void ConnectionManager::DispatchInputEventToView(Id transport_view_id, |
340 EventPtr event) { | 325 EventPtr event) { |
341 const ViewId view_id(ViewIdFromTransportId(transport_view_id)); | 326 const ViewId view_id(ViewIdFromTransportId(transport_view_id)); |
342 | 327 |
343 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id); | 328 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id); |
344 if (!connection) | 329 if (!connection) |
345 connection = GetConnection(view_id.connection_id); | 330 connection = GetConnection(view_id.connection_id); |
346 if (connection) { | 331 if (connection) { |
347 connection->client()->OnViewInputEvent( | 332 connection->client()->OnViewInputEvent( |
348 transport_view_id, event.Pass(), base::Bind(&base::DoNothing)); | 333 transport_view_id, event.Pass(), base::Bind(&base::DoNothing)); |
349 } | 334 } |
350 } | 335 } |
351 | 336 |
352 void ConnectionManager::Create(ApplicationConnection* connection, | 337 void ConnectionManager::Create(ApplicationConnection* connection, |
353 InterfaceRequest<ViewManagerService> request) { | 338 InterfaceRequest<ViewManagerService> request) { |
354 if (window_manager_vm_service_) { | 339 if (window_manager_client_connection_) { |
355 VLOG(1) << "ViewManager interface requested more than once."; | 340 VLOG(1) << "ViewManager interface requested more than once."; |
356 return; | 341 return; |
357 } | 342 } |
358 | 343 |
359 window_manager_vm_service_ = | 344 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( |
360 new ViewManagerServiceImpl(this, | 345 this, kInvalidConnectionId, std::string(), |
361 kInvalidConnectionId, | 346 std::string("mojo:window_manager"), RootViewId())); |
362 std::string(), | 347 DefaultClientConnection* client_connection = |
363 std::string("mojo:window_manager"), | 348 new DefaultClientConnection(this, service.Pass()); |
364 RootViewId()); | 349 client_connection->binding()->Bind(request.Pass()); |
365 AddConnection(window_manager_vm_service_); | 350 client_connection->SetClient(); |
366 WeakBindToRequest(window_manager_vm_service_, &request); | 351 window_manager_client_connection_ = client_connection; |
367 window_manager_vm_service_->Init(InterfaceRequest<ServiceProvider>()); | 352 AddConnection(window_manager_client_connection_); |
| 353 window_manager_client_connection_->service()->Init( |
| 354 window_manager_client_connection_->client(), |
| 355 InterfaceRequest<ServiceProvider>()); |
368 } | 356 } |
369 | 357 |
370 void ConnectionManager::Create( | 358 void ConnectionManager::Create( |
371 ApplicationConnection* connection, | 359 ApplicationConnection* connection, |
372 InterfaceRequest<WindowManagerInternalClient> request) { | 360 InterfaceRequest<WindowManagerInternalClient> request) { |
373 if (wm_internal_client_impl_.get()) { | 361 if (wm_internal_client_impl_.get()) { |
374 VLOG(1) << "WindowManagerInternalClient requested more than once."; | 362 VLOG(1) << "WindowManagerInternalClient requested more than once."; |
375 return; | 363 return; |
376 } | 364 } |
377 | 365 |
378 wm_internal_client_impl_.reset( | 366 wm_internal_client_impl_.reset(new WindowManagerInternalClientImpl(this)); |
379 new WindowManagerInternalClientImpl(this, this)); | |
380 WeakBindToRequest(wm_internal_client_impl_.get(), &request); | 367 WeakBindToRequest(wm_internal_client_impl_.get(), &request); |
381 } | 368 } |
382 | 369 |
383 void ConnectionManager::OnConnectionError() { | |
384 delegate_->OnLostConnectionToWindowManager(); | |
385 } | |
386 | |
387 } // namespace service | 370 } // namespace service |
388 } // namespace mojo | 371 } // namespace mojo |
OLD | NEW |