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 { |
| 24 class PowerSaveBlocker; |
| 25 } // namespace device |
| 26 |
23 namespace content { | 27 namespace content { |
24 | 28 |
25 class PowerSaveBlocker; | |
26 | |
27 // This class manages all RenderFrame based media related managers at the | 29 // This class manages all RenderFrame based media related managers at the |
28 // browser side. It receives IPC messages from media RenderFrameObservers and | 30 // browser side. It receives IPC messages from media RenderFrameObservers and |
29 // forwards them to the corresponding managers. The managers are responsible | 31 // forwards them to the corresponding managers. The managers are responsible |
30 // for sending IPCs back to the RenderFrameObservers at the render side. | 32 // for sending IPCs back to the RenderFrameObservers at the render side. |
31 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { | 33 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
32 public: | 34 public: |
33 explicit MediaWebContentsObserver(WebContents* web_contents); | 35 explicit MediaWebContentsObserver(WebContents* web_contents); |
34 ~MediaWebContentsObserver() override; | 36 ~MediaWebContentsObserver() override; |
35 | 37 |
36 // Called by WebContentsImpl when the audible state may have changed. | 38 // Called by WebContentsImpl when the audible state may have changed. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ActiveMediaPlayerMap* player_map); | 93 ActiveMediaPlayerMap* player_map); |
92 // Removes all entries from |player_map| for |render_frame_host|. Removed | 94 // Removes all entries from |player_map| for |render_frame_host|. Removed |
93 // entries are added to |removed_players|. | 95 // entries are added to |removed_players|. |
94 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host, | 96 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host, |
95 ActiveMediaPlayerMap* player_map, | 97 ActiveMediaPlayerMap* player_map, |
96 std::set<MediaPlayerId>* removed_players); | 98 std::set<MediaPlayerId>* removed_players); |
97 | 99 |
98 // Tracking variables and associated power save blockers for media playback. | 100 // Tracking variables and associated power save blockers for media playback. |
99 ActiveMediaPlayerMap active_audio_players_; | 101 ActiveMediaPlayerMap active_audio_players_; |
100 ActiveMediaPlayerMap active_video_players_; | 102 ActiveMediaPlayerMap active_video_players_; |
101 std::unique_ptr<PowerSaveBlocker> audio_power_save_blocker_; | 103 std::unique_ptr<device::PowerSaveBlocker> audio_power_save_blocker_; |
102 std::unique_ptr<PowerSaveBlocker> video_power_save_blocker_; | 104 std::unique_ptr<device::PowerSaveBlocker> video_power_save_blocker_; |
103 #if defined(OS_ANDROID) | 105 #if defined(OS_ANDROID) |
104 std::unique_ptr<base::WeakPtrFactory<ui::ViewAndroid>> view_weak_factory_; | 106 std::unique_ptr<base::WeakPtrFactory<ui::ViewAndroid>> view_weak_factory_; |
105 #endif | 107 #endif |
106 | 108 |
107 MediaSessionControllersManager session_controllers_manager_; | 109 MediaSessionControllersManager session_controllers_manager_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); | 111 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); |
110 }; | 112 }; |
111 | 113 |
112 } // namespace content | 114 } // namespace content |
113 | 115 |
114 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 116 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |