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

Side by Side Diff: content/renderer/media/android/renderer_media_session_manager.h

Issue 2367393002: Migrating MediaSession messages to mojo (Closed)
Patch Set: fixed layout tests Created 4 years, 2 months 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
(Empty)
1 // Copyright 2015 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_RENDERER_MEDIA_ANDROID_RENDERER_MEDIA_SESSION_MANAGER_H_
6 #define CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_MEDIA_SESSION_MANAGER_H_
7
8 #include <map>
9 #include <memory>
10
11 #include "base/id_map.h"
12 #include "base/macros.h"
13 #include "base/optional.h"
14 #include "content/common/content_export.h"
15 #include "content/public/renderer/render_frame_observer.h"
16 #include "third_party/WebKit/public/platform/modules/mediasession/WebMediaSessio n.h"
17
18 namespace content {
19
20 class WebMediaSessionAndroid;
21 struct MediaMetadata;
22
23 class CONTENT_EXPORT RendererMediaSessionManager : public RenderFrameObserver {
24 public:
25 RendererMediaSessionManager(RenderFrame* render_frame);
26 ~RendererMediaSessionManager() override;
27
28 // RenderFrameObserver override.
29 bool OnMessageReceived(const IPC::Message& msg) override;
30
31 int RegisterMediaSession(WebMediaSessionAndroid* session);
32 void UnregisterMediaSession(int session_id);
33
34 void Activate(
35 int session_id,
36 std::unique_ptr<blink::WebMediaSessionActivateCallback> callback);
37 void Deactivate(
38 int session_id,
39 std::unique_ptr<blink::WebMediaSessionDeactivateCallback> callback);
40 void SetMetadata(
41 int session_id, const base::Optional<MediaMetadata>& metadata);
42
43 void OnDidActivate(int request_id, bool success);
44 void OnDidDeactivate(int request_id);
45
46 private:
47 friend class WebMediaSessionTest;
48
49 // RenderFrameObserver implementation.
50 void OnDestruct() override;
51
52 std::map<int, WebMediaSessionAndroid*> sessions_;
53 int next_session_id_;
54
55 using ActivationRequests =
56 IDMap<blink::WebMediaSessionActivateCallback, IDMapOwnPointer>;
57 ActivationRequests pending_activation_requests_;
58
59 using DeactivationRequests =
60 IDMap<blink::WebMediaSessionDeactivateCallback, IDMapOwnPointer>;
61 DeactivationRequests pending_deactivation_requests_;
62
63 DISALLOW_COPY_AND_ASSIGN(RendererMediaSessionManager);
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_MEDIA_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/media/android/renderer_media_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698