| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "mojo/environment/scoped_chromium_init.h" | 6 #include "mojo/environment/scoped_chromium_init.h" |
| 7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
| 8 #include "mojo/public/cpp/application/run_application.h" | 8 #include "mojo/public/cpp/application/run_application.h" |
| 9 #include "mojo/public/cpp/application/service_provider_impl.h" | 9 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 10 #include "services/media/audio/audio_server_app.h" | 10 #include "services/media/audio/audio_server_app.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 namespace media { | 13 namespace media { |
| 14 namespace audio { | 14 namespace audio { |
| 15 | 15 |
| 16 AudioServerApp::AudioServerApp() {} | 16 AudioServerApp::AudioServerApp() {} |
| 17 | 17 |
| 18 AudioServerApp::~AudioServerApp() {} | 18 AudioServerApp::~AudioServerApp() {} |
| 19 | 19 |
| 20 void AudioServerApp::OnInitialize() {} | 20 void AudioServerApp::OnInitialize() { |
| 21 server_impl_.Initialize(); |
| 22 } |
| 21 | 23 |
| 22 bool AudioServerApp::OnAcceptConnection( | 24 bool AudioServerApp::OnAcceptConnection( |
| 23 ServiceProviderImpl* service_provider_impl) { | 25 ServiceProviderImpl* service_provider_impl) { |
| 24 service_provider_impl->AddService<AudioServer>( | 26 service_provider_impl->AddService<AudioServer>( |
| 25 [this](const ConnectionContext& connection_context, | 27 [this](const ConnectionContext& connection_context, |
| 26 InterfaceRequest<AudioServer> audio_server_request) { | 28 InterfaceRequest<AudioServer> audio_server_request) { |
| 27 bindings_.AddBinding(&server_impl_, audio_server_request.Pass()); | 29 bindings_.AddBinding(&server_impl_, audio_server_request.Pass()); |
| 28 }); | 30 }); |
| 29 return true; | 31 return true; |
| 30 } | 32 } |
| 31 | 33 |
| 32 } // namespace audio | 34 } // namespace audio |
| 33 } // namespace media | 35 } // namespace media |
| 34 } // namespace mojo | 36 } // namespace mojo |
| 35 | 37 |
| 36 MojoResult MojoMain(MojoHandle app_request) { | 38 MojoResult MojoMain(MojoHandle app_request) { |
| 37 mojo::ScopedChromiumInit init; | 39 mojo::ScopedChromiumInit init; |
| 38 mojo::media::audio::AudioServerApp audio_server_app; | 40 mojo::media::audio::AudioServerApp audio_server_app; |
| 39 return mojo::RunApplication(app_request, &audio_server_app); | 41 return mojo::RunApplication(app_request, &audio_server_app); |
| 40 } | 42 } |
| OLD | NEW |