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