| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDER_FRAME_AUDIO_OUTPUT_STREAM_FAC
TORY_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDER_FRAME_AUDIO_OUTPUT_STREAM_FAC
TORY_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/containers/flat_set.h" | |
| 12 #include "content/common/content_export.h" | |
| 13 #include "content/common/media/renderer_audio_output_stream_factory.mojom.h" | |
| 14 #include "mojo/public/cpp/bindings/binding.h" | |
| 15 #include "url/origin.h" | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class RendererAudioOutputStreamFactoryContext; | |
| 20 | |
| 21 // Handles a RendererAudioOutputStreamFactory request for a render frame host, | |
| 22 // using the provided RendererAudioOutputStreamFactoryContext. | |
| 23 class CONTENT_EXPORT RenderFrameAudioOutputStreamFactory | |
| 24 : public mojom::RendererAudioOutputStreamFactory { | |
| 25 public: | |
| 26 RenderFrameAudioOutputStreamFactory( | |
| 27 int render_frame_id, | |
| 28 RendererAudioOutputStreamFactoryContext* context); | |
| 29 | |
| 30 ~RenderFrameAudioOutputStreamFactory() override; | |
| 31 | |
| 32 private: | |
| 33 using OutputStreamProviderSet = | |
| 34 base::flat_set<std::unique_ptr<media::mojom::AudioOutputStreamProvider>>; | |
| 35 | |
| 36 // mojom::RendererAudioOutputStreamFactory implementation. | |
| 37 void RequestDeviceAuthorization( | |
| 38 media::mojom::AudioOutputStreamProviderRequest stream_provider, | |
| 39 int64_t session_id, | |
| 40 const std::string& device_id, | |
| 41 const RequestDeviceAuthorizationCallback& callback) override; | |
| 42 | |
| 43 void RequestDeviceAuthorizationForOrigin( | |
| 44 base::TimeTicks auth_start_time, | |
| 45 media::mojom::AudioOutputStreamProviderRequest stream_provider_request, | |
| 46 int session_id, | |
| 47 const std::string& device_id, | |
| 48 const RequestDeviceAuthorizationCallback& callback, | |
| 49 const url::Origin& origin); | |
| 50 | |
| 51 void AuthorizationCompleted( | |
| 52 base::TimeTicks auth_start_time, | |
| 53 media::mojom::AudioOutputStreamProviderRequest request, | |
| 54 const RequestDeviceAuthorizationCallback& callback, | |
| 55 const url::Origin& origin, | |
| 56 media::OutputDeviceStatus status, | |
| 57 bool should_send_id, | |
| 58 const media::AudioParameters& params, | |
| 59 const std::string& raw_device_id); | |
| 60 | |
| 61 void RemoveStream(media::mojom::AudioOutputStreamProvider* stream_provider); | |
| 62 | |
| 63 const int render_frame_id_; | |
| 64 RendererAudioOutputStreamFactoryContext* const context_; | |
| 65 base::ThreadChecker thread_checker_; | |
| 66 | |
| 67 // The stream providers will contain the corresponding streams. | |
| 68 OutputStreamProviderSet stream_providers_; | |
| 69 | |
| 70 base::WeakPtrFactory<RenderFrameAudioOutputStreamFactory> weak_ptr_factory_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(RenderFrameAudioOutputStreamFactory); | |
| 73 }; | |
| 74 | |
| 75 } // namespace content | |
| 76 | |
| 77 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDER_FRAME_AUDIO_OUTPUT_STREAM_
FACTORY_H_ | |
| OLD | NEW |