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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2383473002: [scheduler] Teach scheduler about audio state (Closed)
Patch Set: WebFrames! Created 4 years, 2 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 audio_muter_.reset(new WebContentsAudioMuter(this)); 1271 audio_muter_.reset(new WebContentsAudioMuter(this));
1272 audio_muter_->StartMuting(); 1272 audio_muter_->StartMuting();
1273 } else { 1273 } else {
1274 DCHECK(audio_muter_); 1274 DCHECK(audio_muter_);
1275 audio_muter_->StopMuting(); 1275 audio_muter_->StopMuting();
1276 } 1276 }
1277 1277
1278 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1278 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1279 DidUpdateAudioMutingState(mute)); 1279 DidUpdateAudioMutingState(mute));
1280 1280
1281 // Notification for UI updates in response to the changed muting state. 1281 OnAudioStateChanged(!mute && audio_stream_monitor_.IsCurrentlyAudible());
1282 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1283 } 1282 }
1284 1283
1285 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { 1284 bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
1286 return bluetooth_connected_device_count_ > 0; 1285 return bluetooth_connected_device_count_ > 0;
1287 } 1286 }
1288 1287
1289 bool WebContentsImpl::IsCrashed() const { 1288 bool WebContentsImpl::IsCrashed() const {
1290 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1289 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1291 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1290 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
1292 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 1291 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 media_web_contents_observer_->MaybeUpdateAudibleState(); 1331 media_web_contents_observer_->MaybeUpdateAudibleState();
1333 } 1332 }
1334 1333
1335 if (delegate_) 1334 if (delegate_)
1336 delegate_->NavigationStateChanged(this, changed_flags); 1335 delegate_->NavigationStateChanged(this, changed_flags);
1337 1336
1338 if (GetOuterWebContents()) 1337 if (GetOuterWebContents())
1339 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags); 1338 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags);
1340 } 1339 }
1341 1340
1341 void WebContentsImpl::OnAudioStateChanged(bool is_audio_playing) {
1342 SendToAllFrames(
1343 new FrameMsg_AudioStateChanged(MSG_ROUTING_NONE, is_audio_playing));
1344
1345 // Notification for UI updates in response to the changed muting state.
1346 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1347 }
1348
1342 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { 1349 base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
1343 return last_active_time_; 1350 return last_active_time_;
1344 } 1351 }
1345 1352
1346 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) { 1353 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) {
1347 last_active_time_ = last_active_time; 1354 last_active_time_ = last_active_time;
1348 } 1355 }
1349 1356
1350 void WebContentsImpl::WasShown() { 1357 void WebContentsImpl::WasShown() {
1351 controller_.SetActive(true); 1358 controller_.SetActive(true);
(...skipping 3914 matching lines...) Expand 10 before | Expand all | Expand 10 after
5266 dialog_manager_ = dialog_manager; 5273 dialog_manager_ = dialog_manager;
5267 } 5274 }
5268 5275
5269 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5276 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5270 auto it = binding_sets_.find(interface_name); 5277 auto it = binding_sets_.find(interface_name);
5271 if (it != binding_sets_.end()) 5278 if (it != binding_sets_.end())
5272 binding_sets_.erase(it); 5279 binding_sets_.erase(it);
5273 } 5280 }
5274 5281
5275 } // namespace content 5282 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698