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 : public ApplicationDelegate, | 18 class MediaFactoryService : public ApplicationDelegate, |
19 public InterfaceFactory<MediaFactory>, | |
20 public MediaFactory { | 19 public MediaFactory { |
21 public: | 20 public: |
22 // Provides common behavior for all objects created by the factory service. | 21 // Provides common behavior for all objects created by the factory service. |
23 class ProductBase : public std::enable_shared_from_this<ProductBase> { | 22 class ProductBase : public std::enable_shared_from_this<ProductBase> { |
24 public: | 23 public: |
25 virtual ~ProductBase(); | 24 virtual ~ProductBase(); |
26 | 25 |
27 protected: | 26 protected: |
28 ProductBase(MediaFactoryService* owner); | 27 ProductBase(MediaFactoryService* owner); |
29 | 28 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 71 |
73 MediaFactoryService(); | 72 MediaFactoryService(); |
74 | 73 |
75 ~MediaFactoryService() override; | 74 ~MediaFactoryService() override; |
76 | 75 |
77 // ApplicationDelegate implementation. | 76 // ApplicationDelegate implementation. |
78 void Initialize(ApplicationImpl* app) override; | 77 void Initialize(ApplicationImpl* app) override; |
79 | 78 |
80 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; | 79 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; |
81 | 80 |
82 // InterfaceFactory<MediaFactory> implementation. | |
83 void Create(const ConnectionContext& connection_context, | |
84 InterfaceRequest<MediaFactory> request) override; | |
85 | |
86 // MediaFactory implementation. | 81 // MediaFactory implementation. |
87 void CreatePlayer(InterfaceHandle<SeekingReader> reader, | 82 void CreatePlayer(InterfaceHandle<SeekingReader> reader, |
88 InterfaceRequest<MediaPlayer> player) override; | 83 InterfaceRequest<MediaPlayer> player) override; |
89 | 84 |
90 void CreateSource(InterfaceHandle<SeekingReader> reader, | 85 void CreateSource(InterfaceHandle<SeekingReader> reader, |
91 Array<MediaTypeSetPtr> allowed_media_types, | 86 Array<MediaTypeSetPtr> allowed_media_types, |
92 InterfaceRequest<MediaSource> source) override; | 87 InterfaceRequest<MediaSource> source) override; |
93 | 88 |
94 void CreateSink(const String& destination_url, | 89 void CreateSink(const String& destination_url, |
95 MediaTypePtr media_type, | 90 MediaTypePtr media_type, |
(...skipping 22 matching lines...) Expand all Loading... |
118 if (!(condition)) { \ | 113 if (!(condition)) { \ |
119 LOG(ERROR) << "request precondition failed: " #condition "."; \ | 114 LOG(ERROR) << "request precondition failed: " #condition "."; \ |
120 UnbindAndReleaseFromOwner(); \ | 115 UnbindAndReleaseFromOwner(); \ |
121 return; \ | 116 return; \ |
122 } | 117 } |
123 | 118 |
124 } // namespace media | 119 } // namespace media |
125 } // namespace mojo | 120 } // namespace mojo |
126 | 121 |
127 #endif // MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ | 122 #endif // MOJO_SERVICES_MEDIA_FACTORY_FACTORY_SERVICE_H_ |
OLD | NEW |