Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / media / audio_state_provider.cc
blobe09356a561f00cb43a524549eede96ea7c8caf2e
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
3 // found in the LICENSE file.
5 #include "content/browser/media/audio_state_provider.h"
7 #include "base/logging.h"
8 #include "content/browser/media/audio_stream_monitor.h"
9 #include "content/public/browser/web_contents.h"
11 namespace content {
13 AudioStateProvider::AudioStateProvider(WebContents* contents)
14 : web_contents_(contents),
15 was_recently_audible_(false) {
16 DCHECK(web_contents_);
19 bool AudioStateProvider::WasRecentlyAudible() const {
20 return was_recently_audible_;
23 void AudioStateProvider::Notify(bool new_state) {
24 if (was_recently_audible_ != new_state) {
25 was_recently_audible_ = new_state;
26 web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
30 } // namespace content