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, | 202 service_->Embed(url, view_id, service_provider.Pass(), |
203 MakeRequest<ServiceProvider>(service_provider.PassMessagePipe()), | 203 ActionCompletedCallback()); |
204 ActionCompletedCallback()); | |
205 } | 204 } |
206 | 205 |
207 void ViewManagerClientImpl::AddView(View* view) { | 206 void ViewManagerClientImpl::AddView(View* view) { |
208 DCHECK(views_.find(view->id()) == views_.end()); | 207 DCHECK(views_.find(view->id()) == views_.end()); |
209 views_[view->id()] = view; | 208 views_[view->id()] = view; |
210 } | 209 } |
211 | 210 |
212 void ViewManagerClientImpl::RemoveView(Id view_id) { | 211 void ViewManagerClientImpl::RemoveView(Id view_id) { |
213 IdToViewMap::iterator it = views_.find(view_id); | 212 IdToViewMap::iterator it = views_.find(view_id); |
214 if (it != views_.end()) | 213 if (it != views_.end()) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 base::Unretained(this)); | 418 base::Unretained(this)); |
420 } | 419 } |
421 | 420 |
422 base::Callback<void(ErrorCode)> | 421 base::Callback<void(ErrorCode)> |
423 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { | 422 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { |
424 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, | 423 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, |
425 base::Unretained(this)); | 424 base::Unretained(this)); |
426 } | 425 } |
427 | 426 |
428 } // namespace mojo | 427 } // namespace mojo |
OLD | NEW |