| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
| 8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
| 9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
| 10 #include "mojo/public/cpp/application/application_runner.h" | 10 #include "mojo/public/cpp/application/application_runner.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 PingableApp() {} | 43 PingableApp() {} |
| 44 ~PingableApp() override {} | 44 ~PingableApp() override {} |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // ApplicationDelegate: | 47 // ApplicationDelegate: |
| 48 void Initialize(mojo::ApplicationImpl* impl) override { | 48 void Initialize(mojo::ApplicationImpl* impl) override { |
| 49 app_url_ = impl->url(); | 49 app_url_ = impl->url(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool ConfigureIncomingConnection( | 52 bool ConfigureIncomingConnection( |
| 53 mojo::ApplicationConnection* connection) override { | 53 mojo::ServiceProviderImpl* service_provider_impl) override { |
| 54 connection->GetServiceProviderImpl().AddService<Pingable>( | 54 service_provider_impl->AddService<Pingable>( |
| 55 [this](const mojo::ConnectionContext& connection_context, | 55 [this](const mojo::ConnectionContext& connection_context, |
| 56 mojo::InterfaceRequest<Pingable> pingable_request) { | 56 mojo::InterfaceRequest<Pingable> pingable_request) { |
| 57 new PingableImpl(pingable_request.Pass(), app_url_, | 57 new PingableImpl(pingable_request.Pass(), app_url_, |
| 58 connection_context.connection_url); | 58 connection_context.connection_url); |
| 59 }); | 59 }); |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 std::string app_url_; | 63 std::string app_url_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 MojoResult MojoMain(MojoHandle application_request) { | 66 MojoResult MojoMain(MojoHandle application_request) { |
| 67 mojo::ApplicationRunner runner( | 67 mojo::ApplicationRunner runner( |
| 68 std::unique_ptr<PingableApp>(new PingableApp())); | 68 std::unique_ptr<PingableApp>(new PingableApp())); |
| 69 return runner.Run(application_request); | 69 return runner.Run(application_request); |
| 70 } | 70 } |
| OLD | NEW |