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

Side by Side Diff: mojo/services/view_manager/connection_manager.cc

Issue 707633005: Minor cleanup of ViewManagerServiceImpl (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | mojo/services/view_manager/view_manager_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 std::string creator_url; 132 std::string creator_url;
133 ConnectionMap::const_iterator it = connection_map_.find(creator_id); 133 ConnectionMap::const_iterator it = connection_map_.find(creator_id);
134 if (it != connection_map_.end()) 134 if (it != connection_map_.end())
135 creator_url = it->second->url(); 135 creator_url = it->second->url();
136 136
137 ViewManagerServiceImpl* connection = 137 ViewManagerServiceImpl* connection =
138 new ViewManagerServiceImpl(this, 138 new ViewManagerServiceImpl(this,
139 creator_id, 139 creator_id,
140 creator_url, 140 creator_url,
141 url.To<std::string>(), 141 url.To<std::string>(),
142 ViewIdFromTransportId(transport_view_id), 142 ViewIdFromTransportId(transport_view_id));
143 service_provider.Pass());
144 AddConnection(connection); 143 AddConnection(connection);
145 WeakBindToPipe(connection, pipe.handle0.Pass()); 144 WeakBindToPipe(connection, pipe.handle0.Pass());
145 connection->Init(service_provider.Pass());
146 OnConnectionMessagedClient(connection->id()); 146 OnConnectionMessagedClient(connection->id());
147 } 147 }
148 148
149 ViewManagerServiceImpl* ConnectionManager::GetConnection( 149 ViewManagerServiceImpl* ConnectionManager::GetConnection(
150 ConnectionSpecificId connection_id) { 150 ConnectionSpecificId connection_id) {
151 ConnectionMap::iterator i = connection_map_.find(connection_id); 151 ConnectionMap::iterator i = connection_map_.find(connection_id);
152 return i == connection_map_.end() ? NULL : i->second; 152 return i == connection_map_.end() ? NULL : i->second;
153 } 153 }
154 154
155 ServerView* ConnectionManager::GetView(const ViewId& id) { 155 ServerView* ConnectionManager::GetView(const ViewId& id) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (window_manager_vm_service_) { 355 if (window_manager_vm_service_) {
356 VLOG(1) << "ViewManager interface requested more than once."; 356 VLOG(1) << "ViewManager interface requested more than once.";
357 return; 357 return;
358 } 358 }
359 359
360 window_manager_vm_service_ = 360 window_manager_vm_service_ =
361 new ViewManagerServiceImpl(this, 361 new ViewManagerServiceImpl(this,
362 kInvalidConnectionId, 362 kInvalidConnectionId,
363 std::string(), 363 std::string(),
364 std::string("mojo:window_manager"), 364 std::string("mojo:window_manager"),
365 RootViewId(), 365 RootViewId());
366 InterfaceRequest<ServiceProvider>());
367 AddConnection(window_manager_vm_service_); 366 AddConnection(window_manager_vm_service_);
368 WeakBindToRequest(window_manager_vm_service_, &request); 367 WeakBindToRequest(window_manager_vm_service_, &request);
368 window_manager_vm_service_->Init(InterfaceRequest<ServiceProvider>());
369 } 369 }
370 370
371 void ConnectionManager::Create( 371 void ConnectionManager::Create(
372 ApplicationConnection* connection, 372 ApplicationConnection* connection,
373 InterfaceRequest<WindowManagerInternalClient> request) { 373 InterfaceRequest<WindowManagerInternalClient> request) {
374 if (wm_internal_client_impl_.get()) { 374 if (wm_internal_client_impl_.get()) {
375 VLOG(1) << "WindowManagerInternalClient requested more than once."; 375 VLOG(1) << "WindowManagerInternalClient requested more than once.";
376 return; 376 return;
377 } 377 }
378 378
379 wm_internal_client_impl_.reset( 379 wm_internal_client_impl_.reset(
380 new WindowManagerInternalClientImpl(this, this)); 380 new WindowManagerInternalClientImpl(this, this));
381 WeakBindToRequest(wm_internal_client_impl_.get(), &request); 381 WeakBindToRequest(wm_internal_client_impl_.get(), &request);
382 } 382 }
383 383
384 void ConnectionManager::OnConnectionError() { 384 void ConnectionManager::OnConnectionError() {
385 delegate_->OnLostConnectionToWindowManager(); 385 delegate_->OnLostConnectionToWindowManager();
386 } 386 }
387 387
388 } // namespace service 388 } // namespace service
389 } // namespace mojo 389 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/services/view_manager/view_manager_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698