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 "services/ui/view_manager/view_manager_app.h" | 5 #include "services/ui/view_manager/view_manager_app.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 associate_urls.push_back("mojo:input_manager_service"); | 54 associate_urls.push_back("mojo:input_manager_service"); |
55 } | 55 } |
56 registry_->ConnectAssociates( | 56 registry_->ConnectAssociates( |
57 app_impl_, associate_urls, | 57 app_impl_, associate_urls, |
58 base::Bind(&ViewManagerApp::OnAssociateConnectionError, | 58 base::Bind(&ViewManagerApp::OnAssociateConnectionError, |
59 base::Unretained(this))); | 59 base::Unretained(this))); |
60 } | 60 } |
61 | 61 |
62 bool ViewManagerApp::ConfigureIncomingConnection( | 62 bool ViewManagerApp::ConfigureIncomingConnection( |
63 mojo::ApplicationConnection* connection) { | 63 mojo::ApplicationConnection* connection) { |
64 connection->AddService<mojo::ui::ViewManager>(this); | 64 connection->GetServiceProviderImpl().AddService<mojo::ui::ViewManager>([this]( |
| 65 const mojo::ConnectionContext& connection_context, |
| 66 mojo::InterfaceRequest<mojo::ui::ViewManager> view_manager_request) { |
| 67 DCHECK(registry_); |
| 68 view_managers_.AddBinding(new ViewManagerImpl(registry_.get()), |
| 69 view_manager_request.Pass()); |
| 70 }); |
65 return true; | 71 return true; |
66 } | 72 } |
67 | 73 |
68 void ViewManagerApp::Create( | |
69 const mojo::ConnectionContext& connection_context, | |
70 mojo::InterfaceRequest<mojo::ui::ViewManager> request) { | |
71 DCHECK(registry_); | |
72 view_managers_.AddBinding(new ViewManagerImpl(registry_.get()), | |
73 request.Pass()); | |
74 } | |
75 | |
76 void ViewManagerApp::OnCompositorConnectionError() { | 74 void ViewManagerApp::OnCompositorConnectionError() { |
77 LOG(ERROR) << "Exiting due to compositor connection error."; | 75 LOG(ERROR) << "Exiting due to compositor connection error."; |
78 Shutdown(); | 76 Shutdown(); |
79 } | 77 } |
80 | 78 |
81 void ViewManagerApp::OnAssociateConnectionError(const std::string& url) { | 79 void ViewManagerApp::OnAssociateConnectionError(const std::string& url) { |
82 LOG(ERROR) << "Exiting due to view associate connection error: url=" << url; | 80 LOG(ERROR) << "Exiting due to view associate connection error: url=" << url; |
83 Shutdown(); | 81 Shutdown(); |
84 } | 82 } |
85 | 83 |
86 void ViewManagerApp::Shutdown() { | 84 void ViewManagerApp::Shutdown() { |
87 app_impl_->Terminate(); | 85 app_impl_->Terminate(); |
88 } | 86 } |
89 | 87 |
90 } // namespace view_manager | 88 } // namespace view_manager |
OLD | NEW |