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