| 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 "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 Loading... |
| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { | 484 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { |
| 466 gfx::Size new_size = size.To<gfx::Size>(); | 485 gfx::Size new_size = size.To<gfx::Size>(); |
| 467 display_manager_->SetViewportSize(new_size); | 486 display_manager_->SetViewportSize(new_size); |
| 468 } | 487 } |
| 469 | 488 |
| 470 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { | 489 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { |
| 471 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); | 490 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); |
| 472 } | 491 } |
| 473 | 492 |
| 474 } // namespace view_manager | 493 } // namespace view_manager |
| OLD | NEW |