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

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

Issue 1166123005: Removes ServiceProviders from ViewManager::Embed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use is_headless rather than check for browser. Created 5 years, 6 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/view_manager/connection_manager.h" 5 #include "components/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 "components/view_manager/client_connection.h" 9 #include "components/view_manager/client_connection.h"
10 #include "components/view_manager/connection_manager_delegate.h" 10 #include "components/view_manager/connection_manager_delegate.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // TODO(sky): I may want to advance focus differently if focus is in 169 // TODO(sky): I may want to advance focus differently if focus is in
170 // |connection|. 170 // |connection|.
171 171
172 // Notify remaining connections so that they can cleanup. 172 // Notify remaining connections so that they can cleanup.
173 for (auto& pair : connection_map_) { 173 for (auto& pair : connection_map_) {
174 pair.second->service()->OnWillDestroyViewManagerServiceImpl( 174 pair.second->service()->OnWillDestroyViewManagerServiceImpl(
175 connection->service()); 175 connection->service());
176 } 176 }
177 } 177 }
178 178
179 void ConnectionManager::EmbedAtView( 179 void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id,
180 ConnectionSpecificId creator_id, 180 const ViewId& view_id,
181 mojo::URLRequestPtr request, 181 mojo::URLRequestPtr request) {
182 const ViewId& view_id,
183 mojo::InterfaceRequest<mojo::ServiceProvider> services,
184 mojo::ServiceProviderPtr exposed_services) {
185 std::string creator_url;
186 ConnectionMap::const_iterator it = connection_map_.find(creator_id);
187 if (it != connection_map_.end())
188 creator_url = it->second->service()->url();
189
190 mojo::ViewManagerServicePtr service_ptr; 182 mojo::ViewManagerServicePtr service_ptr;
191 ClientConnection* client_connection = 183 ClientConnection* client_connection =
192 delegate_->CreateClientConnectionForEmbedAtView( 184 delegate_->CreateClientConnectionForEmbedAtView(
193 this, GetProxy(&service_ptr), creator_id, creator_url, request.Pass(), 185 this, GetProxy(&service_ptr), creator_id, request.Pass(), view_id);
194 view_id);
195 AddConnection(client_connection); 186 AddConnection(client_connection);
196 client_connection->service()->Init(client_connection->client(), 187 client_connection->service()->Init(client_connection->client(),
197 service_ptr.Pass(), services.Pass(), 188 service_ptr.Pass());
198 exposed_services.Pass());
199 OnConnectionMessagedClient(client_connection->service()->id()); 189 OnConnectionMessagedClient(client_connection->service()->id());
200 } 190 }
201 191
202 void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id, 192 void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id,
203 const ViewId& view_id, 193 const ViewId& view_id,
204 mojo::ViewManagerClientPtr client) { 194 mojo::ViewManagerClientPtr client) {
205 std::string creator_url;
206 ConnectionMap::const_iterator it = connection_map_.find(creator_id);
207 if (it != connection_map_.end())
208 creator_url = it->second->service()->url();
209
210 mojo::ViewManagerServicePtr service_ptr; 195 mojo::ViewManagerServicePtr service_ptr;
211 ClientConnection* client_connection = 196 ClientConnection* client_connection =
212 delegate_->CreateClientConnectionForEmbedAtView( 197 delegate_->CreateClientConnectionForEmbedAtView(
213 this, GetProxy(&service_ptr), creator_id, creator_url, view_id, 198 this, GetProxy(&service_ptr), creator_id, view_id, client.Pass());
214 client.Pass());
215 AddConnection(client_connection); 199 AddConnection(client_connection);
216 client_connection->service()->Init(client_connection->client(), 200 client_connection->service()->Init(client_connection->client(),
217 service_ptr.Pass(), nullptr, nullptr); 201 service_ptr.Pass());
218 OnConnectionMessagedClient(client_connection->service()->id()); 202 OnConnectionMessagedClient(client_connection->service()->id());
219 } 203 }
220 204
221 ViewManagerServiceImpl* ConnectionManager::GetConnection( 205 ViewManagerServiceImpl* ConnectionManager::GetConnection(
222 ConnectionSpecificId connection_id) { 206 ConnectionSpecificId connection_id) {
223 ConnectionMap::iterator i = connection_map_.find(connection_id); 207 ConnectionMap::iterator i = connection_map_.find(connection_id);
224 return i == connection_map_.end() ? nullptr : i->second->service(); 208 return i == connection_map_.end() ? nullptr : i->second->service();
225 } 209 }
226 210
227 ServerView* ConnectionManager::GetView(const ViewId& id) { 211 ServerView* ConnectionManager::GetView(const ViewId& id) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 261 }
278 return nullptr; 262 return nullptr;
279 } 263 }
280 264
281 void ConnectionManager::SetWindowManagerClientConnection( 265 void ConnectionManager::SetWindowManagerClientConnection(
282 scoped_ptr<ClientConnection> connection) { 266 scoped_ptr<ClientConnection> connection) {
283 CHECK(!window_manager_client_connection_); 267 CHECK(!window_manager_client_connection_);
284 window_manager_client_connection_ = connection.release(); 268 window_manager_client_connection_ = connection.release();
285 AddConnection(window_manager_client_connection_); 269 AddConnection(window_manager_client_connection_);
286 window_manager_client_connection_->service()->Init( 270 window_manager_client_connection_->service()->Init(
287 window_manager_client_connection_->client(), nullptr, nullptr, nullptr); 271 window_manager_client_connection_->client(), nullptr);
288 } 272 }
289 273
290 mojo::ViewManagerClient* 274 mojo::ViewManagerClient*
291 ConnectionManager::GetWindowManagerViewManagerClient() { 275 ConnectionManager::GetWindowManagerViewManagerClient() {
292 CHECK(window_manager_client_connection_); 276 CHECK(window_manager_client_connection_);
293 return window_manager_client_connection_->client(); 277 return window_manager_client_connection_->client();
294 } 278 }
295 279
296 bool ConnectionManager::CloneAndAnimate(const ViewId& view_id) { 280 bool ConnectionManager::CloneAndAnimate(const ViewId& view_id) {
297 ServerView* view = GetView(view_id); 281 ServerView* view = GetView(view_id);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (wm_connection != owning_connection_old && 601 if (wm_connection != owning_connection_old &&
618 wm_connection != embedded_connection_old && 602 wm_connection != embedded_connection_old &&
619 wm_connection != owning_connection_new && 603 wm_connection != owning_connection_new &&
620 wm_connection != embedded_connection_new) { 604 wm_connection != embedded_connection_new) {
621 wm_connection->ProcessFocusChanged(old_focused_view, new_focused_view); 605 wm_connection->ProcessFocusChanged(old_focused_view, new_focused_view);
622 } 606 }
623 } 607 }
624 } 608 }
625 609
626 } // namespace view_manager 610 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/view_manager/connection_manager.h ('k') | components/view_manager/connection_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698