| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/logging.h" |
| Viet-Trung Luu | 911b5de | 2016-05-31 12:19:19 -0700 | [diff] [blame] | 6 | #include "mojo/environment/scoped_chromium_init.h" |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 7 | #include "mojo/public/c/system/main.h" |
| Viet-Trung Luu | afa7692 | 2016-05-26 10:57:15 -0700 | [diff] [blame] | 8 | #include "mojo/public/cpp/application/run_application.h" |
| 9 | #include "mojo/public/cpp/application/service_provider_impl.h" |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 10 | #include "services/media/audio/audio_server_app.h" |
| 11 | |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 12 | namespace mojo { |
| 13 | namespace media { |
| 14 | namespace audio { |
| 15 | |
| 16 | AudioServerApp::AudioServerApp() {} |
| Viet-Trung Luu | afa7692 | 2016-05-26 10:57:15 -0700 | [diff] [blame] | 17 | |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 18 | AudioServerApp::~AudioServerApp() {} |
| 19 | |
| Dale Sather | 520b7ed | 2016-05-31 15:32:39 -0700 | [diff] [blame] | 20 | void AudioServerApp::OnInitialize() { |
| 21 | server_impl_.Initialize(); |
| 22 | } |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 23 | |
| Viet-Trung Luu | afa7692 | 2016-05-26 10:57:15 -0700 | [diff] [blame] | 24 | bool AudioServerApp::OnAcceptConnection( |
| Viet-Trung Luu | 22e78b3 | 2016-05-13 15:27:15 -0700 | [diff] [blame] | 25 | ServiceProviderImpl* service_provider_impl) { |
| 26 | service_provider_impl->AddService<AudioServer>( |
| Viet-Trung Luu | 688f68e | 2016-05-13 14:12:04 -0700 | [diff] [blame] | 27 | [this](const ConnectionContext& connection_context, |
| 28 | InterfaceRequest<AudioServer> audio_server_request) { |
| 29 | bindings_.AddBinding(&server_impl_, audio_server_request.Pass()); |
| 30 | }); |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 31 | return true; |
| 32 | } |
| 33 | |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 34 | } // namespace audio |
| 35 | } // namespace media |
| 36 | } // namespace mojo |
| 37 | |
| 38 | MojoResult MojoMain(MojoHandle app_request) { |
| Viet-Trung Luu | 911b5de | 2016-05-31 12:19:19 -0700 | [diff] [blame] | 39 | mojo::ScopedChromiumInit init; |
| Viet-Trung Luu | afa7692 | 2016-05-26 10:57:15 -0700 | [diff] [blame] | 40 | mojo::media::audio::AudioServerApp audio_server_app; |
| Viet-Trung Luu | 911b5de | 2016-05-31 12:19:19 -0700 | [diff] [blame] | 41 | return mojo::RunApplication(app_request, &audio_server_app); |
| John Grossman | 1cff1d3 | 2015-11-10 18:35:49 -0800 | [diff] [blame] | 42 | } |