OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "content/browser/media/session/media_session_controllers_manager.h" | 15 #include "content/browser/media/session/media_session_controllers_manager.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
18 | 18 |
19 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
20 #include "ui/android/view_android.h" | 20 #include "ui/android/view_android.h" |
21 #endif // OS_ANDROID | 21 #endif // OS_ANDROID |
22 | 22 |
23 namespace device { | 23 namespace device { |
24 class PowerSaveBlocker; | 24 class PowerSaveBlocker; |
25 } // namespace device | 25 } // namespace device |
26 | 26 |
| 27 namespace media { |
| 28 enum class MediaContentType; |
| 29 } // namespace media |
| 30 |
27 namespace content { | 31 namespace content { |
28 | 32 |
29 // This class manages all RenderFrame based media related managers at the | 33 // This class manages all RenderFrame based media related managers at the |
30 // browser side. It receives IPC messages from media RenderFrameObservers and | 34 // browser side. It receives IPC messages from media RenderFrameObservers and |
31 // forwards them to the corresponding managers. The managers are responsible | 35 // forwards them to the corresponding managers. The managers are responsible |
32 // for sending IPCs back to the RenderFrameObservers at the render side. | 36 // for sending IPCs back to the RenderFrameObservers at the render side. |
33 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { | 37 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
34 public: | 38 public: |
35 explicit MediaWebContentsObserver(WebContents* web_contents); | 39 explicit MediaWebContentsObserver(WebContents* web_contents); |
36 ~MediaWebContentsObserver() override; | 40 ~MediaWebContentsObserver() override; |
(...skipping 25 matching lines...) Expand all Loading... |
62 private: | 66 private: |
63 void OnMediaDestroyed(RenderFrameHost* render_frame_host, int delegate_id); | 67 void OnMediaDestroyed(RenderFrameHost* render_frame_host, int delegate_id); |
64 void OnMediaPaused(RenderFrameHost* render_frame_host, | 68 void OnMediaPaused(RenderFrameHost* render_frame_host, |
65 int delegate_id, | 69 int delegate_id, |
66 bool reached_end_of_stream); | 70 bool reached_end_of_stream); |
67 void OnMediaPlaying(RenderFrameHost* render_frame_host, | 71 void OnMediaPlaying(RenderFrameHost* render_frame_host, |
68 int delegate_id, | 72 int delegate_id, |
69 bool has_video, | 73 bool has_video, |
70 bool has_audio, | 74 bool has_audio, |
71 bool is_remote, | 75 bool is_remote, |
72 base::TimeDelta duration); | 76 media::MediaContentType media_content_type); |
73 | 77 |
74 // Clear |render_frame_host|'s tracking entry for its power save blockers. | 78 // Clear |render_frame_host|'s tracking entry for its power save blockers. |
75 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); | 79 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); |
76 | 80 |
77 // Creates an audio or video power save blocker respectively. | 81 // Creates an audio or video power save blocker respectively. |
78 void CreateAudioPowerSaveBlocker(); | 82 void CreateAudioPowerSaveBlocker(); |
79 void CreateVideoPowerSaveBlocker(); | 83 void CreateVideoPowerSaveBlocker(); |
80 | 84 |
81 // Releases the audio power save blockers if |active_audio_players_| is empty. | 85 // Releases the audio power save blockers if |active_audio_players_| is empty. |
82 // Likewise, releases the video power save blockers if |active_video_players_| | 86 // Likewise, releases the video power save blockers if |active_video_players_| |
(...skipping 24 matching lines...) Expand all Loading... |
107 #endif | 111 #endif |
108 | 112 |
109 MediaSessionControllersManager session_controllers_manager_; | 113 MediaSessionControllersManager session_controllers_manager_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); | 115 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace content | 118 } // namespace content |
115 | 119 |
116 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 120 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |