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