| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ | 5 #ifndef MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ |
| 6 #define MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ | 6 #define MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "mojo/common/binding_set.h" | 10 #include "mojo/common/binding_set.h" |
| 11 #include "mojo/public/cpp/application/application_delegate.h" | 11 #include "mojo/public/cpp/application/application_delegate.h" |
| 12 #include "mojo/public/cpp/application/application_impl.h" | 12 #include "mojo/public/cpp/application/application_impl.h" |
| 13 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" | 13 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class MediaFactoryService : | 18 class MediaFactoryService : public ApplicationDelegate, |
| 19 public ApplicationDelegate, | 19 public InterfaceFactory<MediaFactory>, |
| 20 public InterfaceFactory<MediaFactory>, | 20 public MediaFactory { |
| 21 public MediaFactory { | |
| 22 public: | 21 public: |
| 23 // Provides common behavior for all objects created by the factory service. | 22 // Provides common behavior for all objects created by the factory service. |
| 24 class Product : public std::enable_shared_from_this<Product> { | 23 class Product : public std::enable_shared_from_this<Product> { |
| 25 public: | 24 public: |
| 26 virtual ~Product(); | 25 virtual ~Product(); |
| 27 | 26 |
| 28 protected: | 27 protected: |
| 29 Product(MediaFactoryService* owner); | 28 Product(MediaFactoryService* owner); |
| 30 | 29 |
| 31 // Returns the ApplicationImpl. | 30 // Returns the ApplicationImpl. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 MediaFactoryService* owner_; | 43 MediaFactoryService* owner_; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 MediaFactoryService(); | 46 MediaFactoryService(); |
| 48 | 47 |
| 49 ~MediaFactoryService() override; | 48 ~MediaFactoryService() override; |
| 50 | 49 |
| 51 // ApplicationDelegate implementation. | 50 // ApplicationDelegate implementation. |
| 52 void Initialize(ApplicationImpl* app) override; | 51 void Initialize(ApplicationImpl* app) override; |
| 53 | 52 |
| 54 bool ConfigureIncomingConnection( | 53 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; |
| 55 ApplicationConnection* connection) override; | |
| 56 | 54 |
| 57 // InterfaceFactory<MediaFactory> implementation. | 55 // InterfaceFactory<MediaFactory> implementation. |
| 58 void Create( | 56 void Create(ApplicationConnection* connection, |
| 59 ApplicationConnection* connection, | 57 InterfaceRequest<MediaFactory> request) override; |
| 60 InterfaceRequest<MediaFactory> request) override; | |
| 61 | 58 |
| 62 // MediaFactory implementation. | 59 // MediaFactory implementation. |
| 63 void CreatePlayer( | 60 void CreatePlayer(const String& origin_url, |
| 64 const String& origin_url, | 61 InterfaceRequest<MediaPlayer> player) override; |
| 65 InterfaceRequest<MediaPlayer> player) override; | |
| 66 | 62 |
| 67 void CreateSource( | 63 void CreateSource(const String& origin_url, |
| 68 const String& origin_url, | 64 Array<MediaTypeSetPtr> allowed_media_types, |
| 69 Array<MediaTypeSetPtr> allowed_media_types, | 65 InterfaceRequest<MediaSource> source) override; |
| 70 InterfaceRequest<MediaSource> source) override; | |
| 71 | 66 |
| 72 void CreateSink( | 67 void CreateSink(const String& destination_url, |
| 73 const String& destination_url, | 68 MediaTypePtr media_type, |
| 74 MediaTypePtr media_type, | 69 InterfaceRequest<MediaSink> sink) override; |
| 75 InterfaceRequest<MediaSink> sink) override; | |
| 76 | 70 |
| 77 void CreateDecoder( | 71 void CreateDecoder(MediaTypePtr input_media_type, |
| 78 MediaTypePtr input_media_type, | 72 InterfaceRequest<MediaTypeConverter> decoder) override; |
| 79 InterfaceRequest<MediaTypeConverter> decoder) override; | |
| 80 | 73 |
| 81 private: | 74 private: |
| 82 BindingSet<MediaFactory> bindings_; | 75 BindingSet<MediaFactory> bindings_; |
| 83 ApplicationImpl* app_; | 76 ApplicationImpl* app_; |
| 84 std::unordered_set<std::shared_ptr<Product>> products_; | 77 std::unordered_set<std::shared_ptr<Product>> products_; |
| 85 }; | 78 }; |
| 86 | 79 |
| 87 } // namespace media | 80 } // namespace media |
| 88 } // namespace mojo | 81 } // namespace mojo |
| 89 | 82 |
| 90 #endif // MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ | 83 #endif // MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ |
| OLD | NEW |