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

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

Issue 2383473002: [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Switched approach to use WebContentsImpl::WasRecentlyAudible 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 audio_muter_.reset(new WebContentsAudioMuter(this)); 1268 audio_muter_.reset(new WebContentsAudioMuter(this));
1269 audio_muter_->StartMuting(); 1269 audio_muter_->StartMuting();
1270 } else { 1270 } else {
1271 DCHECK(audio_muter_); 1271 DCHECK(audio_muter_);
1272 audio_muter_->StopMuting(); 1272 audio_muter_->StopMuting();
1273 } 1273 }
1274 1274
1275 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1275 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1276 DidUpdateAudioMutingState(mute)); 1276 DidUpdateAudioMutingState(mute));
1277 1277
1278 // Notification for UI updates in response to the changed muting state. 1278 OnAudioStateChanged(!mute && audio_stream_monitor_.IsCurrentlyAudible());
1279 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1280 } 1279 }
1281 1280
1282 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { 1281 bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
1283 return bluetooth_connected_device_count_ > 0; 1282 return bluetooth_connected_device_count_ > 0;
1284 } 1283 }
1285 1284
1286 bool WebContentsImpl::IsCrashed() const { 1285 bool WebContentsImpl::IsCrashed() const {
1287 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1286 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1288 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1287 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
1289 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 1288 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 media_web_contents_observer_->MaybeUpdateAudibleState(); 1328 media_web_contents_observer_->MaybeUpdateAudibleState();
1330 } 1329 }
1331 1330
1332 if (delegate_) 1331 if (delegate_)
1333 delegate_->NavigationStateChanged(this, changed_flags); 1332 delegate_->NavigationStateChanged(this, changed_flags);
1334 1333
1335 if (GetOuterWebContents()) 1334 if (GetOuterWebContents())
1336 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags); 1335 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags);
1337 } 1336 }
1338 1337
1338 void WebContentsImpl::OnAudioStateChanged(bool is_audio_playing) {
1339 Send(new ViewMsg_AudioStateChanged(GetRoutingID(), is_audio_playing));
1340
1341 // Notification for UI updates in response to the changed muting state.
1342 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1343 }
1344
1339 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { 1345 base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
1340 return last_active_time_; 1346 return last_active_time_;
1341 } 1347 }
1342 1348
1343 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) { 1349 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) {
1344 last_active_time_ = last_active_time; 1350 last_active_time_ = last_active_time;
1345 } 1351 }
1346 1352
1347 void WebContentsImpl::WasShown() { 1353 void WebContentsImpl::WasShown() {
1348 controller_.SetActive(true); 1354 controller_.SetActive(true);
(...skipping 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after
5258 dialog_manager_ = dialog_manager; 5264 dialog_manager_ = dialog_manager;
5259 } 5265 }
5260 5266
5261 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5267 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5262 auto it = binding_sets_.find(interface_name); 5268 auto it = binding_sets_.find(interface_name);
5263 if (it != binding_sets_.end()) 5269 if (it != binding_sets_.end())
5264 binding_sets_.erase(it); 5270 binding_sets_.erase(it);
5265 } 5271 }
5266 5272
5267 } // namespace content 5273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698