| 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 "components/view_manager/public/cpp/view_manager_init.h" | 5 #include "components/view_manager/public/cpp/view_manager_init.h" |
| 6 | 6 |
| 7 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h" | 7 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h" |
| 8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 connection_->ConnectToService(&view_manager_root_); | 43 connection_->ConnectToService(&view_manager_root_); |
| 44 if (root_client) { | 44 if (root_client) { |
| 45 root_client_binding_.reset(new Binding<ViewManagerRootClient>(root_client)); | 45 root_client_binding_.reset(new Binding<ViewManagerRootClient>(root_client)); |
| 46 ViewManagerRootClientPtr root_client_ptr; | 46 ViewManagerRootClientPtr root_client_ptr; |
| 47 root_client_binding_->Bind(GetProxy(&root_client_ptr)); | 47 root_client_binding_->Bind(GetProxy(&root_client_ptr)); |
| 48 view_manager_root_->SetViewManagerRootClient(root_client_ptr.Pass()); | 48 view_manager_root_->SetViewManagerRootClient(root_client_ptr.Pass()); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 ViewManagerInit::~ViewManagerInit() { | 52 ViewManagerInit::~ViewManagerInit() { |
| 53 connection_->CloseConnection(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void ViewManagerInit::OnCreate(InterfaceRequest<ViewManagerClient> request) { | 56 void ViewManagerInit::OnCreate(InterfaceRequest<ViewManagerClient> request) { |
| 56 // TODO(sky): straighten out lifetime. | 57 // TODO(sky): straighten out lifetime. |
| 57 ViewManagerClientImpl* client = new ViewManagerClientImpl( | 58 ViewManagerClientImpl* client = new ViewManagerClientImpl( |
| 58 delegate_, app_->shell(), request.Pass()); | 59 delegate_, app_->shell(), request.Pass()); |
| 59 service_.set_error_handler(nullptr); | 60 service_.set_error_handler(nullptr); |
| 60 client->SetViewManagerService(service_.Pass()); | 61 client->SetViewManagerService(service_.Pass()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void ViewManagerInit::OnConnectionError() { | 64 void ViewManagerInit::OnConnectionError() { |
| 64 app_->Terminate(); | 65 app_->Terminate(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace mojo | 68 } // namespace mojo |
| OLD | NEW |