blob: e09356a561f00cb43a524549eede96ea7c8caf2e [file] [log] [blame]
timavf6f6f692015-03-04 02:19:371// 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.
4
5#include "content/browser/media/audio_state_provider.h"
6
7#include "base/logging.h"
8#include "content/browser/media/audio_stream_monitor.h"
9#include "content/public/browser/web_contents.h"
10
11namespace content {
12
13AudioStateProvider::AudioStateProvider(WebContents* contents)
14 : web_contents_(contents),
15 was_recently_audible_(false) {
16 DCHECK(web_contents_);
17}
18
19bool AudioStateProvider::WasRecentlyAudible() const {
20 return was_recently_audible_;
21}
22
23void 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);
27 }
28}
29
30} // namespace content