OLD | NEW |
(Empty) | |
| 1 #include "content/browser/media/audio_state_provider.h" |
| 2 |
| 3 #include "base/logging.h" |
| 4 #include "content/browser/media/audio_stream_monitor.h" |
| 5 #include "content/public/browser/web_contents.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 AudioStateProvider::AudioStateProvider(WebContents* contents) |
| 10 : web_contents_(contents), |
| 11 was_recently_audible_(false) { |
| 12 DCHECK(web_contents_); |
| 13 } |
| 14 |
| 15 |
| 16 // static |
| 17 bool AudioStateProvider::audio_state_available() { |
| 18 #if defined OS_ANDROID |
| 19 return true; |
| 20 #else |
| 21 return AudioStreamMonitor::monitoring_available(); |
| 22 #endif // !defined OS_ANDROID |
| 23 } |
| 24 |
| 25 bool AudioStateProvider::WasRecentlyAudible() const { |
| 26 return was_recently_audible_; |
| 27 } |
| 28 |
| 29 void AudioStateProvider::Notify(bool new_state) { |
| 30 if (was_recently_audible_ != new_state) { |
| 31 was_recently_audible_ = new_state; |
| 32 web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
| 33 } |
| 34 } |
| 35 |
| 36 } // namespace content |
OLD | NEW |