| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "media/mojo/interfaces/service_factory.mojom.h" | 10 #include "media/mojo/interfaces/service_factory.mojom.h" |
| 10 #include "media/mojo/services/mojo_cdm_service_context.h" | 11 #include "media/mojo/services/mojo_cdm_service_context.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 | 13 |
| 13 namespace mojo { | 14 namespace mojo { |
| 15 class AppRefCount; |
| 14 class ServiceProvider; | 16 class ServiceProvider; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace media { | 19 namespace media { |
| 18 | 20 |
| 19 class CdmFactory; | 21 class CdmFactory; |
| 20 class MediaLog; | 22 class MediaLog; |
| 21 class RendererFactory; | 23 class RendererFactory; |
| 22 | 24 |
| 23 class ServiceFactoryImpl : public interfaces::ServiceFactory { | 25 class ServiceFactoryImpl : public interfaces::ServiceFactory { |
| 24 public: | 26 public: |
| 25 ServiceFactoryImpl(mojo::InterfaceRequest<interfaces::ServiceFactory> request, | 27 ServiceFactoryImpl(mojo::InterfaceRequest<interfaces::ServiceFactory> request, |
| 26 mojo::ServiceProvider* service_provider, | 28 mojo::ServiceProvider* service_provider, |
| 27 scoped_refptr<MediaLog> media_log); | 29 scoped_refptr<MediaLog> media_log, |
| 30 scoped_ptr<mojo::AppRefCount> parent_app_refcount); |
| 28 ~ServiceFactoryImpl() final; | 31 ~ServiceFactoryImpl() final; |
| 29 | 32 |
| 30 // interfaces::ServiceFactory implementation. | 33 // interfaces::ServiceFactory implementation. |
| 31 void CreateRenderer( | 34 void CreateRenderer( |
| 32 mojo::InterfaceRequest<interfaces::MediaRenderer> renderer) final; | 35 mojo::InterfaceRequest<interfaces::MediaRenderer> renderer) final; |
| 33 void CreateCdm( | 36 void CreateCdm( |
| 34 mojo::InterfaceRequest<interfaces::ContentDecryptionModule> cdm) final; | 37 mojo::InterfaceRequest<interfaces::ContentDecryptionModule> cdm) final; |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 RendererFactory* GetRendererFactory(); | 40 RendererFactory* GetRendererFactory(); |
| 38 CdmFactory* GetCdmFactory(); | 41 CdmFactory* GetCdmFactory(); |
| 39 | 42 |
| 40 MojoCdmServiceContext cdm_service_context_; | 43 MojoCdmServiceContext cdm_service_context_; |
| 41 | 44 |
| 42 mojo::StrongBinding<interfaces::ServiceFactory> binding_; | 45 mojo::StrongBinding<interfaces::ServiceFactory> binding_; |
| 43 mojo::ServiceProvider* service_provider_; | 46 mojo::ServiceProvider* service_provider_; |
| 44 scoped_refptr<MediaLog> media_log_; | 47 scoped_refptr<MediaLog> media_log_; |
| 48 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; |
| 45 | 49 |
| 46 scoped_ptr<RendererFactory> renderer_factory_; | 50 scoped_ptr<RendererFactory> renderer_factory_; |
| 47 scoped_ptr<CdmFactory> cdm_factory_; | 51 scoped_ptr<CdmFactory> cdm_factory_; |
| 48 | 52 |
| 49 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl); |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 } // namespace media | 56 } // namespace media |
| 53 | 57 |
| 54 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ | 58 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ |
| OLD | NEW |