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 "view_manager/public/cpp/view.h" | 5 #include "view_manager/public/cpp/view.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "mojo/public/cpp/application/service_provider_impl.h" | 9 #include "mojo/public/cpp/application/service_provider_impl.h" |
10 #include "view_manager/public/cpp/lib/view_manager_client_impl.h" | 10 #include "view_manager/public/cpp/lib/view_manager_client_impl.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 void View::SetFocus() { | 353 void View::SetFocus() { |
354 if (manager_) | 354 if (manager_) |
355 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); | 355 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); |
356 } | 356 } |
357 | 357 |
358 void View::Embed(const String& url) { | 358 void View::Embed(const String& url) { |
359 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_); | 359 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_); |
360 } | 360 } |
361 | 361 |
362 scoped_ptr<ServiceProvider> | 362 void View::Embed(const String& url, |
363 View::Embed(const String& url, | 363 InterfaceRequest<ServiceProvider> services, |
364 scoped_ptr<ServiceProviderImpl> exported_services) { | 364 ServiceProviderPtr exposed_services) { |
365 scoped_ptr<ServiceProvider> imported_services; | |
366 // BindToProxy() takes ownership of |exported_services|. | |
367 ServiceProviderImpl* registry = exported_services.release(); | |
368 ServiceProviderPtr sp; | |
369 if (registry) { | |
370 BindToProxy(registry, &sp); | |
371 imported_services.reset(registry->CreateRemoteServiceProvider()); | |
372 } | |
373 static_cast<ViewManagerClientImpl*>(manager_) | 365 static_cast<ViewManagerClientImpl*>(manager_) |
374 ->Embed(url, id_, MakeRequest<ServiceProvider>(sp.PassMessagePipe())); | 366 ->Embed(url, id_, services.Pass(), exposed_services.Pass()); |
375 return imported_services.Pass(); | |
376 } | |
377 | |
378 void View::Embed(const String& url, | |
379 InterfaceRequest<ServiceProvider> exported_services) { | |
380 static_cast<ViewManagerClientImpl*>(manager_) | |
381 ->Embed(url, id_, exported_services.Pass()); | |
382 } | 367 } |
383 | 368 |
384 //////////////////////////////////////////////////////////////////////////////// | 369 //////////////////////////////////////////////////////////////////////////////// |
385 // View, protected: | 370 // View, protected: |
386 | 371 |
387 View::View() | 372 View::View() |
388 : manager_(NULL), | 373 : manager_(NULL), |
389 id_(static_cast<Id>(-1)), | 374 id_(static_cast<Id>(-1)), |
390 parent_(NULL), | 375 parent_(NULL), |
391 visible_(true), | 376 visible_(true), |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 void View::NotifyViewVisibilityChangedUp(View* target) { | 533 void View::NotifyViewVisibilityChangedUp(View* target) { |
549 // Start with the parent as we already notified |this| | 534 // Start with the parent as we already notified |this| |
550 // in NotifyViewVisibilityChangedDown. | 535 // in NotifyViewVisibilityChangedDown. |
551 for (View* view = parent(); view; view = view->parent()) { | 536 for (View* view = parent(); view; view = view->parent()) { |
552 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); | 537 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); |
553 DCHECK(ret); | 538 DCHECK(ret); |
554 } | 539 } |
555 } | 540 } |
556 | 541 |
557 } // namespace mojo | 542 } // namespace mojo |
OLD | NEW |