Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index f7505af877b67c2644609a9ff6920d39dfba84a0..fe8fb358060b07f154868a01334a0a1eb8f62eb7 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -120,7 +120,6 @@ |
#if defined(OS_ANDROID) |
#include "content/browser/android/content_video_view.h" |
#include "content/browser/android/date_time_chooser_android.h" |
-#include "content/browser/android/media_players_observer.h" |
#include "content/browser/media/android/media_session.h" |
#include "content/browser/web_contents/web_contents_android.h" |
#endif |
@@ -403,6 +402,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) |
geolocation_service_context_(new GeolocationServiceContext()), |
accessibility_mode_( |
BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
+ audio_stream_monitor_(this), |
virtual_keyboard_requested_(false), |
loading_weak_factory_(this) { |
frame_tree_.SetFrameRemoveListener( |
@@ -411,12 +411,6 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) |
#if defined(ENABLE_BROWSER_CDMS) |
media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
#endif |
- |
-#if defined(OS_ANDROID) |
- audio_state_provider_.reset(new MediaPlayersObserver(this)); |
-#else |
- audio_state_provider_.reset(new AudioStreamMonitor(this)); |
-#endif |
} |
WebContentsImpl::~WebContentsImpl() { |
@@ -1157,7 +1151,7 @@ void WebContentsImpl::NotifyNavigationStateChanged( |
// Create and release the audio power save blocker depending on whether the |
// tab is actively producing audio or not. |
if ((changed_flags & INVALIDATE_TYPE_TAB) && |
- audio_state_provider_->IsAudioStateAvailable()) { |
+ AudioStreamMonitor::monitoring_available()) { |
if (WasRecentlyAudible()) { |
if (!audio_power_save_blocker_) |
CreateAudioPowerSaveBlocker(); |
@@ -2734,7 +2728,7 @@ void WebContentsImpl::InsertCSS(const std::string& css) { |
} |
bool WebContentsImpl::WasRecentlyAudible() { |
- return audio_state_provider_->WasRecentlyAudible(); |
+ return audio_stream_monitor_.WasRecentlyAudible(); |
} |
void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { |
@@ -3343,7 +3337,7 @@ void WebContentsImpl::MaybeReleasePowerSaveBlockers() { |
// monitoring, release the audio power save blocker here instead of during |
// NotifyNavigationStateChanged(). |
if (active_audio_players_.empty() && |
- !audio_state_provider_->IsAudioStateAvailable()) { |
+ !AudioStreamMonitor::monitoring_available()) { |
audio_power_save_blocker_.reset(); |
} |
@@ -3366,7 +3360,7 @@ void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, |
// If we don't have audio stream monitoring, allocate the audio power save |
// blocker here instead of during NotifyNavigationStateChanged(). |
if (!audio_power_save_blocker_ && |
- !audio_state_provider_->IsAudioStateAvailable()) { |
+ !AudioStreamMonitor::monitoring_available()) { |
CreateAudioPowerSaveBlocker(); |
} |
} |