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_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/containers/scoped_ptr_hash_map.h" | 12 #include "base/containers/scoped_ptr_hash_map.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "content/browser/media/media_web_contents_observer.h" | 14 #include "content/browser/media/media_web_contents_observer.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 enum class MediaContentType; | 18 enum class MediaContentType; |
19 } // namespace media | 19 } // namespace media |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class BrowserCdmManager; | |
24 class BrowserMediaPlayerManager; | 23 class BrowserMediaPlayerManager; |
25 class BrowserMediaSessionManager; | 24 class BrowserMediaSessionManager; |
26 class BrowserSurfaceViewManager; | 25 class BrowserSurfaceViewManager; |
27 | 26 |
28 // This class adds Android specific extensions to the MediaWebContentsObserver. | 27 // This class adds Android specific extensions to the MediaWebContentsObserver. |
29 class CONTENT_EXPORT MediaWebContentsObserverAndroid | 28 class CONTENT_EXPORT MediaWebContentsObserverAndroid |
30 : public MediaWebContentsObserver { | 29 : public MediaWebContentsObserver { |
31 public: | 30 public: |
32 explicit MediaWebContentsObserverAndroid(WebContents* web_contents); | 31 explicit MediaWebContentsObserverAndroid(WebContents* web_contents); |
33 ~MediaWebContentsObserverAndroid() override; | 32 ~MediaWebContentsObserverAndroid() override; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; | 74 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
76 bool OnMessageReceived(const IPC::Message& message, | 75 bool OnMessageReceived(const IPC::Message& message, |
77 RenderFrameHost* render_frame_host) override; | 76 RenderFrameHost* render_frame_host) override; |
78 | 77 |
79 private: | 78 private: |
80 // Helper functions to handle media player IPC messages. Returns whether the | 79 // Helper functions to handle media player IPC messages. Returns whether the |
81 // |message| is handled in the function. | 80 // |message| is handled in the function. |
82 bool OnMediaPlayerMessageReceived(const IPC::Message& message, | 81 bool OnMediaPlayerMessageReceived(const IPC::Message& message, |
83 RenderFrameHost* render_frame_host); | 82 RenderFrameHost* render_frame_host); |
84 | 83 |
85 bool OnMediaPlayerSetCdmMessageReceived(const IPC::Message& message, | |
86 RenderFrameHost* render_frame_host); | |
87 | |
88 bool OnMediaSessionMessageReceived(const IPC::Message& message, | 84 bool OnMediaSessionMessageReceived(const IPC::Message& message, |
89 RenderFrameHost* render_frame_host); | 85 RenderFrameHost* render_frame_host); |
90 | 86 |
91 bool OnSurfaceViewManagerMessageReceived(const IPC::Message& message, | 87 bool OnSurfaceViewManagerMessageReceived(const IPC::Message& message, |
92 RenderFrameHost* render_frame_host); | 88 RenderFrameHost* render_frame_host); |
93 | 89 |
94 void OnSetCdm(RenderFrameHost* render_frame_host, int player_id, int cdm_id); | |
95 | |
96 // Map from RenderFrameHost* to BrowserMediaPlayerManager. | 90 // Map from RenderFrameHost* to BrowserMediaPlayerManager. |
97 using MediaPlayerManagerMap = | 91 using MediaPlayerManagerMap = |
98 base::ScopedPtrHashMap<RenderFrameHost*, | 92 base::ScopedPtrHashMap<RenderFrameHost*, |
99 std::unique_ptr<BrowserMediaPlayerManager>>; | 93 std::unique_ptr<BrowserMediaPlayerManager>>; |
100 MediaPlayerManagerMap media_player_managers_; | 94 MediaPlayerManagerMap media_player_managers_; |
101 | 95 |
102 // Map from RenderFrameHost* to BrowserMediaSessionManager. | 96 // Map from RenderFrameHost* to BrowserMediaSessionManager. |
103 using MediaSessionManagerMap = | 97 using MediaSessionManagerMap = |
104 base::ScopedPtrHashMap<RenderFrameHost*, | 98 base::ScopedPtrHashMap<RenderFrameHost*, |
105 std::unique_ptr<BrowserMediaSessionManager>>; | 99 std::unique_ptr<BrowserMediaSessionManager>>; |
106 MediaSessionManagerMap media_session_managers_; | 100 MediaSessionManagerMap media_session_managers_; |
107 | 101 |
108 using SurfaceViewManagerMap = | 102 using SurfaceViewManagerMap = |
109 base::ScopedPtrHashMap<RenderFrameHost*, | 103 base::ScopedPtrHashMap<RenderFrameHost*, |
110 std::unique_ptr<BrowserSurfaceViewManager>>; | 104 std::unique_ptr<BrowserSurfaceViewManager>>; |
111 SurfaceViewManagerMap surface_view_managers_; | 105 SurfaceViewManagerMap surface_view_managers_; |
112 | 106 |
113 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserverAndroid); | 107 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserverAndroid); |
114 }; | 108 }; |
115 | 109 |
116 } // namespace content | 110 } // namespace content |
117 | 111 |
118 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 112 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
OLD | NEW |