| 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 #ifndef MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ |
| 6 #define MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ | 6 #define MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "media/mojo/interfaces/service_factory.mojom.h" | 11 #include "media/mojo/interfaces/service_factory.mojom.h" |
| 12 #include "media/mojo/services/mojo_cdm_service_context.h" | 12 #include "media/mojo/services/mojo_cdm_service_context.h" |
| 13 #include "services/service_manager/public/cpp/connector.h" | 13 #include "services/service_manager/public/cpp/connector.h" |
| 14 #include "services/service_manager/public/cpp/service_context_ref.h" | 14 #include "services/service_manager/public/cpp/service_context_ref.h" |
| 15 | 15 |
| 16 namespace shell { | 16 namespace service_manager { |
| 17 namespace mojom { | 17 namespace mojom { |
| 18 class InterfaceProvider; | 18 class InterfaceProvider; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 class CdmFactory; | 24 class CdmFactory; |
| 25 class MediaLog; | 25 class MediaLog; |
| 26 class MojoMediaClient; | 26 class MojoMediaClient; |
| 27 class RendererFactory; | 27 class RendererFactory; |
| 28 | 28 |
| 29 class ServiceFactoryImpl : public mojom::ServiceFactory { | 29 class ServiceFactoryImpl : public mojom::ServiceFactory { |
| 30 public: | 30 public: |
| 31 ServiceFactoryImpl(shell::mojom::InterfaceProviderPtr interfaces, | 31 ServiceFactoryImpl( |
| 32 scoped_refptr<MediaLog> media_log, | 32 service_manager::mojom::InterfaceProviderPtr interfaces, |
| 33 std::unique_ptr<shell::ServiceContextRef> connection_ref, | 33 scoped_refptr<MediaLog> media_log, |
| 34 MojoMediaClient* mojo_media_client); | 34 std::unique_ptr<service_manager::ServiceContextRef> connection_ref, |
| 35 MojoMediaClient* mojo_media_client); |
| 35 ~ServiceFactoryImpl() final; | 36 ~ServiceFactoryImpl() final; |
| 36 | 37 |
| 37 // mojom::ServiceFactory implementation. | 38 // mojom::ServiceFactory implementation. |
| 38 void CreateAudioDecoder(mojom::AudioDecoderRequest request) final; | 39 void CreateAudioDecoder(mojom::AudioDecoderRequest request) final; |
| 39 void CreateVideoDecoder(mojom::VideoDecoderRequest request) final; | 40 void CreateVideoDecoder(mojom::VideoDecoderRequest request) final; |
| 40 void CreateRenderer(const std::string& audio_device_id, | 41 void CreateRenderer(const std::string& audio_device_id, |
| 41 mojom::RendererRequest request) final; | 42 mojom::RendererRequest request) final; |
| 42 void CreateCdm(mojom::ContentDecryptionModuleRequest request) final; | 43 void CreateCdm(mojom::ContentDecryptionModuleRequest request) final; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 #if defined(ENABLE_MOJO_RENDERER) | 46 #if defined(ENABLE_MOJO_RENDERER) |
| 46 RendererFactory* GetRendererFactory(); | 47 RendererFactory* GetRendererFactory(); |
| 47 #endif // defined(ENABLE_MOJO_RENDERER) | 48 #endif // defined(ENABLE_MOJO_RENDERER) |
| 48 | 49 |
| 49 #if defined(ENABLE_MOJO_CDM) | 50 #if defined(ENABLE_MOJO_CDM) |
| 50 CdmFactory* GetCdmFactory(); | 51 CdmFactory* GetCdmFactory(); |
| 51 #endif // defined(ENABLE_MOJO_CDM) | 52 #endif // defined(ENABLE_MOJO_CDM) |
| 52 | 53 |
| 53 MojoCdmServiceContext cdm_service_context_; | 54 MojoCdmServiceContext cdm_service_context_; |
| 54 | 55 |
| 55 #if defined(ENABLE_MOJO_RENDERER) | 56 #if defined(ENABLE_MOJO_RENDERER) |
| 56 std::unique_ptr<RendererFactory> renderer_factory_; | 57 std::unique_ptr<RendererFactory> renderer_factory_; |
| 57 #endif // defined(ENABLE_MOJO_RENDERER) | 58 #endif // defined(ENABLE_MOJO_RENDERER) |
| 58 | 59 |
| 59 #if defined(ENABLE_MOJO_CDM) | 60 #if defined(ENABLE_MOJO_CDM) |
| 60 std::unique_ptr<CdmFactory> cdm_factory_; | 61 std::unique_ptr<CdmFactory> cdm_factory_; |
| 61 shell::mojom::InterfaceProviderPtr interfaces_; | 62 service_manager::mojom::InterfaceProviderPtr interfaces_; |
| 62 #endif // defined(ENABLE_MOJO_CDM) | 63 #endif // defined(ENABLE_MOJO_CDM) |
| 63 | 64 |
| 64 scoped_refptr<MediaLog> media_log_; | 65 scoped_refptr<MediaLog> media_log_; |
| 65 std::unique_ptr<shell::ServiceContextRef> connection_ref_; | 66 std::unique_ptr<service_manager::ServiceContextRef> connection_ref_; |
| 66 MojoMediaClient* mojo_media_client_; | 67 MojoMediaClient* mojo_media_client_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl); | 69 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace media | 72 } // namespace media |
| 72 | 73 |
| 73 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ | 74 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ |
| OLD | NEW |