Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6913)

Unified Diff: content/browser/media/media_web_contents_observer.h

Issue 2846813002: Convert MediaWebContentsObsever to be the client of WakeLock mojo interface. (Closed)
Patch Set: remove dependency, code rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/media/media_web_contents_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/media_web_contents_observer.h
diff --git a/content/browser/media/media_web_contents_observer.h b/content/browser/media/media_web_contents_observer.h
index 3a2a0d3a5c3c8b8b8dc2c0d3de3c532eb58a4c05..0e61ecffbc80b73aaa3d6ce210fb727e3cfe7eb3 100644
--- a/content/browser/media/media_web_contents_observer.h
+++ b/content/browser/media/media_web_contents_observer.h
@@ -15,15 +15,12 @@
#include "content/browser/media/session/media_session_controllers_manager.h"
#include "content/common/content_export.h"
#include "content/public/browser/web_contents_observer.h"
+#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
#if defined(OS_ANDROID)
#include "ui/android/view_android.h"
#endif // OS_ANDROID
-namespace device {
-class PowerSaveBlocker;
-} // namespace device
-
namespace media {
enum class MediaContentType;
} // namespace media
@@ -63,12 +60,12 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver {
// fullscreening video element to the same place.
void RequestPersistentVideo(bool value);
- bool has_audio_power_save_blocker_for_testing() const {
- return !!audio_power_save_blocker_;
+ bool has_audio_wake_lock_for_testing() const {
+ return has_audio_wake_lock_for_testing_;
}
- bool has_video_power_save_blocker_for_testing() const {
- return !!video_power_save_blocker_;
+ bool has_video_wake_lock_for_testing() const {
+ return has_video_wake_lock_for_testing_;
}
protected:
@@ -91,17 +88,18 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver {
int delegate_id,
bool is_fullscreen);
- // Clear |render_frame_host|'s tracking entry for its power save blockers.
- void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host);
+ // Clear |render_frame_host|'s tracking entry for its WakeLocks.
+ void ClearWakeLocks(RenderFrameHost* render_frame_host);
+
+ device::mojom::WakeLockService* GetAudioWakeLock();
+ device::mojom::WakeLockService* GetVideoWakeLock();
- // Creates an audio or video power save blocker respectively.
- void CreateAudioPowerSaveBlocker();
- void CreateVideoPowerSaveBlocker();
+ void LockAudio();
+ void LockVideo();
- // Releases the audio power save blockers if |active_audio_players_| is empty.
- // Likewise, releases the video power save blockers if |active_video_players_|
- // is empty.
- void MaybeReleasePowerSaveBlockers();
+ void CancelAudioLock();
+ void CancelVideoLock();
+ void MaybeCancelVideoLock();
// Helper methods for adding or removing player entries in |player_map|.
using PlayerSet = std::set<int>;
@@ -117,12 +115,14 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver {
ActiveMediaPlayerMap* player_map,
std::set<MediaPlayerId>* removed_players);
- // Tracking variables and associated power save blockers for media playback.
+ // Tracking variables and associated wake locks for media playback.
ActiveMediaPlayerMap active_audio_players_;
ActiveMediaPlayerMap active_video_players_;
- std::unique_ptr<device::PowerSaveBlocker> audio_power_save_blocker_;
- std::unique_ptr<device::PowerSaveBlocker> video_power_save_blocker_;
+ device::mojom::WakeLockServicePtr audio_wake_lock_;
+ device::mojom::WakeLockServicePtr video_wake_lock_;
base::Optional<MediaPlayerId> fullscreen_player_;
+ bool has_audio_wake_lock_for_testing_;
+ bool has_video_wake_lock_for_testing_;
MediaSessionControllersManager session_controllers_manager_;
« no previous file with comments | « no previous file | content/browser/media/media_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698