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/public/cpp/view_manager/lib/view_manager_client_impl.h" | 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ServiceProviderPtr sp; | 192 ServiceProviderPtr sp; |
193 BindToProxy(new ServiceProviderImpl, &sp); | 193 BindToProxy(new ServiceProviderImpl, &sp); |
194 Embed(url, view_id, sp.Pass()); | 194 Embed(url, view_id, sp.Pass()); |
195 } | 195 } |
196 | 196 |
197 void ViewManagerClientImpl::Embed( | 197 void ViewManagerClientImpl::Embed( |
198 const String& url, | 198 const String& url, |
199 Id view_id, | 199 Id view_id, |
200 ServiceProviderPtr service_provider) { | 200 ServiceProviderPtr service_provider) { |
201 DCHECK(connected_); | 201 DCHECK(connected_); |
202 service_->Embed(url, view_id, service_provider.Pass(), | 202 service_->Embed(url, view_id, |
203 ActionCompletedCallback()); | 203 MakeRequest<ServiceProvider>(service_provider.PassMessagePipe()), |
| 204 ActionCompletedCallback()); |
204 } | 205 } |
205 | 206 |
206 void ViewManagerClientImpl::AddView(View* view) { | 207 void ViewManagerClientImpl::AddView(View* view) { |
207 DCHECK(views_.find(view->id()) == views_.end()); | 208 DCHECK(views_.find(view->id()) == views_.end()); |
208 views_[view->id()] = view; | 209 views_[view->id()] = view; |
209 } | 210 } |
210 | 211 |
211 void ViewManagerClientImpl::RemoveView(Id view_id) { | 212 void ViewManagerClientImpl::RemoveView(Id view_id) { |
212 IdToViewMap::iterator it = views_.find(view_id); | 213 IdToViewMap::iterator it = views_.find(view_id); |
213 if (it != views_.end()) | 214 if (it != views_.end()) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 base::Unretained(this)); | 419 base::Unretained(this)); |
419 } | 420 } |
420 | 421 |
421 base::Callback<void(ErrorCode)> | 422 base::Callback<void(ErrorCode)> |
422 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { | 423 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { |
423 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, | 424 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, |
424 base::Unretained(this)); | 425 base::Unretained(this)); |
425 } | 426 } |
426 | 427 |
427 } // namespace mojo | 428 } // namespace mojo |
OLD | NEW |