| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/base_view.h" | 5 #include "mojo/ui/base_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 BaseView::BaseView( | 12 BaseView::BaseView( |
| 13 mojo::ApplicationImpl* app_impl, | 13 mojo::ApplicationImpl* app_impl, |
| 14 const std::string& label, | 14 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
| 15 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback) | 15 const std::string& label) |
| 16 : app_impl_(app_impl), view_binding_(this) { | 16 : app_impl_(app_impl), view_binding_(this) { |
| 17 DCHECK(app_impl_); | 17 DCHECK(app_impl_); |
| 18 app_impl_->ConnectToService("mojo:view_manager_service", &view_manager_); | 18 app_impl_->ConnectToService("mojo:view_manager_service", &view_manager_); |
| 19 | 19 |
| 20 mojo::ui::ViewPtr view; | 20 mojo::ui::ViewPtr view; |
| 21 view_binding_.Bind(mojo::GetProxy(&view)); | 21 view_binding_.Bind(mojo::GetProxy(&view)); |
| 22 view_manager_->RegisterView(view.Pass(), mojo::GetProxy(&view_host_), label, | 22 view_manager_->RegisterView(view.Pass(), mojo::GetProxy(&view_host_), |
| 23 create_view_callback); | 23 view_owner_request.Pass(), label); |
| 24 view_host_->CreateScene(mojo::GetProxy(&scene_)); | 24 view_host_->CreateScene(mojo::GetProxy(&scene_)); |
| 25 view_host_->GetServiceProvider(mojo::GetProxy(&view_service_provider_)); | 25 view_host_->GetServiceProvider(mojo::GetProxy(&view_service_provider_)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 BaseView::~BaseView() {} | 28 BaseView::~BaseView() {} |
| 29 | 29 |
| 30 void BaseView::OnChildUnavailable(uint32_t child_key, | 30 void BaseView::OnChildUnavailable(uint32_t child_key, |
| 31 const OnChildUnavailableCallback& callback) { | 31 const OnChildUnavailableCallback& callback) { |
| 32 callback.Run(); | 32 callback.Run(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace ui | 35 } // namespace ui |
| 36 } // namespace mojo | 36 } // namespace mojo |
| OLD | NEW |