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

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

Issue 905083002: Adds Embed() variant to ViewManagerService that takes ViewManagerClient (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: real comments Created 5 years, 10 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 "services/view_manager/connection_manager.h" 5 #include "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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ClientConnection* client_connection = 175 ClientConnection* client_connection =
176 delegate_->CreateClientConnectionForEmbedAtView( 176 delegate_->CreateClientConnectionForEmbedAtView(
177 this, GetProxy(&service_ptr), creator_id, creator_url, url, view_id); 177 this, GetProxy(&service_ptr), creator_id, creator_url, url, view_id);
178 AddConnection(client_connection); 178 AddConnection(client_connection);
179 client_connection->service()->Init(client_connection->client(), 179 client_connection->service()->Init(client_connection->client(),
180 service_ptr.Pass(), services.Pass(), 180 service_ptr.Pass(), services.Pass(),
181 exposed_services.Pass()); 181 exposed_services.Pass());
182 OnConnectionMessagedClient(client_connection->service()->id()); 182 OnConnectionMessagedClient(client_connection->service()->id());
183 } 183 }
184 184
185 void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id,
186 const ViewId& view_id,
187 mojo::ViewManagerClientPtr client) {
188 std::string creator_url;
189 ConnectionMap::const_iterator it = connection_map_.find(creator_id);
190 if (it != connection_map_.end())
191 creator_url = it->second->service()->url();
192
193 mojo::ViewManagerServicePtr service_ptr;
194 ClientConnection* client_connection =
195 delegate_->CreateClientConnectionForEmbedAtView(
196 this, GetProxy(&service_ptr), creator_id, creator_url, view_id,
197 client.Pass());
198 AddConnection(client_connection);
199 client_connection->service()->Init(client_connection->client(),
200 service_ptr.Pass(), nullptr, nullptr);
201 OnConnectionMessagedClient(client_connection->service()->id());
202 }
203
185 ViewManagerServiceImpl* ConnectionManager::GetConnection( 204 ViewManagerServiceImpl* ConnectionManager::GetConnection(
186 ConnectionSpecificId connection_id) { 205 ConnectionSpecificId connection_id) {
187 ConnectionMap::iterator i = connection_map_.find(connection_id); 206 ConnectionMap::iterator i = connection_map_.find(connection_id);
188 return i == connection_map_.end() ? nullptr : i->second->service(); 207 return i == connection_map_.end() ? nullptr : i->second->service();
189 } 208 }
190 209
191 ServerView* ConnectionManager::GetView(const ViewId& id) { 210 ServerView* ConnectionManager::GetView(const ViewId& id) {
192 if (id == root_->id()) 211 if (id == root_->id())
193 return root_.get(); 212 return root_.get();
194 ViewManagerServiceImpl* service = GetConnection(id.connection_id); 213 ViewManagerServiceImpl* service = GetConnection(id.connection_id);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { 479 void ConnectionManager::SetViewportSize(mojo::SizePtr size) {
461 gfx::Size new_size = size.To<gfx::Size>(); 480 gfx::Size new_size = size.To<gfx::Size>();
462 display_manager_->SetViewportSize(new_size); 481 display_manager_->SetViewportSize(new_size);
463 } 482 }
464 483
465 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { 484 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) {
466 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); 485 CloneAndAnimate(ViewIdFromTransportId(transport_view_id));
467 } 486 }
468 487
469 } // namespace view_manager 488 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698