Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: content/browser/media/session/media_session_service_impl.h

Issue 2442303002: Adding new media controls to MediaNotification (Closed)
Patch Set: rebased onto MediaSession refactoring Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 MediaSessionImpl;
15 class RenderFrameHost; 16 class RenderFrameHost;
16 17
17 // There is one MediaSessionService per frame. 18 // There is one MediaSessionService per frame.
18 class MediaSessionServiceImpl : public blink::mojom::MediaSessionService { 19 class MediaSessionServiceImpl : public blink::mojom::MediaSessionService {
19 public: 20 public:
20 ~MediaSessionServiceImpl() override; 21 ~MediaSessionServiceImpl() override;
21 22
22 static void Create(RenderFrameHost* render_frame_host, 23 static void Create(RenderFrameHost* render_frame_host,
23 blink::mojom::MediaSessionServiceRequest request); 24 blink::mojom::MediaSessionServiceRequest request);
25 const blink::mojom::MediaSessionClientPtr& GetClient() { return client_; }
24 26
25 private: 27 private:
26 explicit MediaSessionServiceImpl(RenderFrameHost* render_frame_host); 28 explicit MediaSessionServiceImpl(RenderFrameHost* render_frame_host);
27 29
28 // blink::mojom::MediaSessionService implementation. 30 // blink::mojom::MediaSessionService implementation.
29 void SetClient(blink::mojom::MediaSessionClientPtr client) override; 31 void SetClient(blink::mojom::MediaSessionClientPtr client) override;
30 32
31 void SetMetadata( 33 void SetMetadata(
32 const base::Optional<content::MediaMetadata>& metadata) override; 34 const base::Optional<content::MediaMetadata>& metadata) override;
33 35
34 void EnableAction(blink::mojom::MediaSessionAction action) override; 36 void EnableAction(blink::mojom::MediaSessionAction action) override;
35 void DisableAction(blink::mojom::MediaSessionAction action) override; 37 void DisableAction(blink::mojom::MediaSessionAction action) override;
36 38
39 // Returns the content::MediaSession this service is associated with. Only
40 // returns non-null when this service is in the top-level frame.
41 MediaSessionImpl* GetMediaSession();
42
37 void Bind(blink::mojom::MediaSessionServiceRequest request); 43 void Bind(blink::mojom::MediaSessionServiceRequest request);
38 44
39 RenderFrameHost* render_frame_host_; 45 RenderFrameHost* render_frame_host_;
40 46
41 // RAII binding of |this| to an MediaSessionService interface request. 47 // RAII binding of |this| to an MediaSessionService interface request.
42 // The binding is removed when binding_ is cleared or goes out of scope. 48 // The binding is removed when binding_ is cleared or goes out of scope.
43 std::unique_ptr<mojo::Binding<blink::mojom::MediaSessionService>> binding_; 49 std::unique_ptr<mojo::Binding<blink::mojom::MediaSessionService>> binding_;
44 blink::mojom::MediaSessionClientPtr client_; 50 blink::mojom::MediaSessionClientPtr client_;
45 51
46 DISALLOW_COPY_AND_ASSIGN(MediaSessionServiceImpl); 52 DISALLOW_COPY_AND_ASSIGN(MediaSessionServiceImpl);
47 }; 53 };
48 54
49 } // namespace content 55 } // namespace content
50 56
51 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_SERVICE_IMPL_H_ 57 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698