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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_SERVICE_IMPL_H_ |
7 | 7 |
| 8 #include "base/optional.h" |
| 9 #include "content/public/common/media_metadata.h" |
8 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
9 #include "third_party/WebKit/public/platform/modules/mediasession/media_session.
mojom.h" | 11 #include "third_party/WebKit/public/platform/modules/mediasession/media_session.
mojom.h" |
10 | 12 |
11 namespace content { | 13 namespace content { |
12 | 14 |
13 class RenderFrameHost; | 15 class RenderFrameHost; |
14 | 16 |
| 17 // There is one MediaSessionService per frame. |
15 class MediaSessionServiceImpl : public blink::mojom::MediaSessionService { | 18 class MediaSessionServiceImpl : public blink::mojom::MediaSessionService { |
16 public: | 19 public: |
17 ~MediaSessionServiceImpl() override; | 20 ~MediaSessionServiceImpl() override; |
18 | 21 |
19 static void Create(RenderFrameHost* render_frame_host, | 22 static void Create(RenderFrameHost* render_frame_host, |
20 blink::mojom::MediaSessionServiceRequest request); | 23 blink::mojom::MediaSessionServiceRequest request); |
21 | 24 |
22 private: | 25 private: |
23 explicit MediaSessionServiceImpl(RenderFrameHost* render_frame_host); | 26 explicit MediaSessionServiceImpl(RenderFrameHost* render_frame_host); |
24 | 27 |
25 void SetMetadata( | 28 void SetMetadata( |
26 const base::Optional<content::MediaMetadata>& metadata) override; | 29 const base::Optional<content::MediaMetadata>& metadata) override; |
27 | 30 |
28 void Bind(blink::mojom::MediaSessionServiceRequest request); | 31 void Bind(blink::mojom::MediaSessionServiceRequest request); |
29 | 32 |
30 RenderFrameHost* render_frame_host_; | 33 RenderFrameHost* render_frame_host_; |
31 | 34 |
32 // RAII binding of |this| to an MediaSession interface request. | 35 base::Optional<MediaMetadata> metadata_; |
| 36 |
| 37 // RAII binding of |this| to an MediaSessionService interface request. |
33 // The binding is removed when binding_ is cleared or goes out of scope. | 38 // The binding is removed when binding_ is cleared or goes out of scope. |
34 std::unique_ptr<mojo::Binding<blink::mojom::MediaSessionService>> binding_; | 39 std::unique_ptr<mojo::Binding<blink::mojom::MediaSessionService>> binding_; |
35 | 40 |
36 DISALLOW_COPY_AND_ASSIGN(MediaSessionServiceImpl); | 41 DISALLOW_COPY_AND_ASSIGN(MediaSessionServiceImpl); |
37 }; | 42 }; |
38 | 43 |
39 } // namespace content | 44 } // namespace content |
40 | 45 |
41 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_SERVICE_IMPL_H_ | 46 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_SERVICE_IMPL_H_ |
OLD | NEW |