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

Side by Side Diff: content/browser/media/android/media_session.h

Issue 1671603002: Mute audio for Spitzer playbacks that haven't received focus yet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/media/android/media_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ANDROID_MEDIA_SESSION_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_
6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // above. 97 // above.
98 bool IsControllable() const; 98 bool IsControllable() const;
99 99
100 // Returns if the session is currently suspended. 100 // Returns if the session is currently suspended.
101 bool IsSuspended() const; 101 bool IsSuspended() const;
102 102
103 private: 103 private:
104 friend class content::WebContentsUserData<MediaSession>; 104 friend class content::WebContentsUserData<MediaSession>;
105 friend class ::MediaSessionBrowserTest; 105 friend class ::MediaSessionBrowserTest;
106 106
107 // Resets the |j_media_session_| ref to prevent calling the Java backend
108 // during content_browsertests.
109 void ResetJavaRefForTest();
110 bool IsActiveForTest() const;
111 Type audio_focus_type_for_test() const;
112 void RemoveAllPlayersForTest();
113 MediaSessionUmaHelper* uma_helper_for_test();
114
115 enum class State { 107 enum class State {
116 ACTIVE, 108 ACTIVE,
117 SUSPENDED, 109 SUSPENDED,
118 INACTIVE 110 INACTIVE
119 }; 111 };
120 112
121 enum class SuspendType { 113 enum class SuspendType {
122 // Suspended by the system because a transient sound needs to be played. 114 // Suspended by the system because a transient sound needs to be played.
123 SYSTEM, 115 SYSTEM,
124 // Suspended by the UI. 116 // Suspended by the UI.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Notifies WebContents about the state change of the media session. 158 // Notifies WebContents about the state change of the media session.
167 void UpdateWebContents(); 159 void UpdateWebContents();
168 160
169 // Internal method that should be used instead of setting audio_focus_state_. 161 // Internal method that should be used instead of setting audio_focus_state_.
170 // It sets audio_focus_state_ and notifies observers about the state change. 162 // It sets audio_focus_state_ and notifies observers about the state change.
171 void SetAudioFocusState(State audio_focus_state); 163 void SetAudioFocusState(State audio_focus_state);
172 164
173 base::android::ScopedJavaGlobalRef<jobject> j_media_session_; 165 base::android::ScopedJavaGlobalRef<jobject> j_media_session_;
174 PlayersMap players_; 166 PlayersMap players_;
175 167
168 // The value returned by RequestSystemAudioFocus() when |j_media_session_| is
169 // unavailable. Used for testing.
170 bool default_system_audio_focus_response_;
171
176 State audio_focus_state_; 172 State audio_focus_state_;
177 SuspendType suspend_type_; 173 SuspendType suspend_type_;
178 Type audio_focus_type_; 174 Type audio_focus_type_;
179 175
180 MediaSessionUmaHelper uma_helper_; 176 MediaSessionUmaHelper uma_helper_;
181 177
182 // The volume multiplier of this session. All players in this session should 178 // The volume multiplier of this session. All players in this session should
183 // multiply their volume with this multiplier to get the effective volume. 179 // multiply their volume with this multiplier to get the effective volume.
184 double volume_multiplier_; 180 double volume_multiplier_;
185 181
186 DISALLOW_COPY_AND_ASSIGN(MediaSession); 182 DISALLOW_COPY_AND_ASSIGN(MediaSession);
187 }; 183 };
188 184
189 } // namespace content 185 } // namespace content
190 186
191 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ 187 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/android/media_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698