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

Side by Side Diff: content/browser/media/audio_state_provider.cc

Issue 896673003: Propagate audible state from player to the containing tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AudioStreamMonitor and corresponding Android monitor now have common base class Created 5 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698