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

Unified Diff: content/browser/media/android/media_session.h

Issue 1243683003: Android MediaSession: do not resume a UI suspended session on a system resume. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests Created 5 years, 5 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
Index: content/browser/media/android/media_session.h
diff --git a/content/browser/media/android/media_session.h b/content/browser/media/android/media_session.h
index 55e430bb418149fe1a2f674c55696f8ce0214ac5..87e5397bab37d6879464132caf5479e7486b3d13 100644
--- a/content/browser/media/android/media_session.h
+++ b/content/browser/media/android/media_session.h
@@ -38,6 +38,13 @@ class CONTENT_EXPORT MediaSession
Transient
};
+ enum class SuspendType {
+ // Suspended by the system because a transient sound needs to be played.
+ System,
qinmin 2015/07/21 22:58:17 s/System/SYSTEM/
+ // Suspended by the UI.
+ UI,
+ };
+
static bool RegisterMediaSession(JNIEnv* env);
// Returns the MediaSession associated to this WebContents. Creates one if
@@ -69,11 +76,11 @@ class CONTENT_EXPORT MediaSession
// Called when the user requests resuming the session. No-op if the session is
// not controllable.
- void Resume();
+ void Resume(SuspendType type);
// Called when the user requests suspending the session. No-op if the session
// is not controllable.
- void Suspend();
+ void Suspend(SuspendType type);
// Returns if the session can be controlled by Resume() and Suspend calls
// above.
@@ -93,13 +100,13 @@ class CONTENT_EXPORT MediaSession
Type audio_focus_type_for_test() const;
void RemoveAllPlayersForTest();
- void OnSuspendInternal(bool temporary);
- void OnResumeInternal();
+ void OnSuspendInternal(SuspendType type);
+ void OnResumeInternal(SuspendType type);
enum class State {
Active,
qinmin 2015/07/21 22:58:17 change all the enum names here ACTIVE, SUSPENDED,
- TemporarilySuspended,
Suspended,
+ Inactive
};
// Representation of a player for the MediaSession.
@@ -141,6 +148,7 @@ class CONTENT_EXPORT MediaSession
PlayersMap players_;
State audio_focus_state_;
+ SuspendType suspend_type_;
Type audio_focus_type_;
DISALLOW_COPY_AND_ASSIGN(MediaSession);

Powered by Google App Engine
This is Rietveld 408576698