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

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

Issue 2383473002: [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Rebased 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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 audio_muter_.reset(new WebContentsAudioMuter(this)); 1248 audio_muter_.reset(new WebContentsAudioMuter(this));
1249 audio_muter_->StartMuting(); 1249 audio_muter_->StartMuting();
1250 } else { 1250 } else {
1251 DCHECK(audio_muter_); 1251 DCHECK(audio_muter_);
1252 audio_muter_->StopMuting(); 1252 audio_muter_->StopMuting();
1253 } 1253 }
1254 1254
1255 for (auto& observer : observers_) 1255 for (auto& observer : observers_)
1256 observer.DidUpdateAudioMutingState(mute); 1256 observer.DidUpdateAudioMutingState(mute);
1257 1257
1258 // Notification for UI updates in response to the changed muting state. 1258 OnAudioStateChanged(!mute && audio_stream_monitor_.IsCurrentlyAudible());
1259 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1260 } 1259 }
1261 1260
1262 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { 1261 bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
1263 return bluetooth_connected_device_count_ > 0; 1262 return bluetooth_connected_device_count_ > 0;
1264 } 1263 }
1265 1264
1266 bool WebContentsImpl::IsCrashed() const { 1265 bool WebContentsImpl::IsCrashed() const {
1267 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1266 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1268 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1267 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
1269 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 1268 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 media_web_contents_observer_->MaybeUpdateAudibleState(); 1308 media_web_contents_observer_->MaybeUpdateAudibleState();
1310 } 1309 }
1311 1310
1312 if (delegate_) 1311 if (delegate_)
1313 delegate_->NavigationStateChanged(this, changed_flags); 1312 delegate_->NavigationStateChanged(this, changed_flags);
1314 1313
1315 if (GetOuterWebContents()) 1314 if (GetOuterWebContents())
1316 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags); 1315 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags);
1317 } 1316 }
1318 1317
1318 void WebContentsImpl::OnAudioStateChanged(bool is_audio_playing) {
1319 SendPageMessage(
1320 new PageMsg_AudioStateChanged(MSG_ROUTING_NONE, is_audio_playing));
1321
1322 // Notification for UI updates in response to the changed muting state.
miu 2016/11/15 22:04:04 nit: The wording here could be confusing. There ar
altimin 2016/11/16 12:22:32 Addressed in crrev.com/2496173003
1323 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1324 }
1325
1319 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { 1326 base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
1320 return last_active_time_; 1327 return last_active_time_;
1321 } 1328 }
1322 1329
1323 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) { 1330 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) {
1324 last_active_time_ = last_active_time; 1331 last_active_time_ = last_active_time;
1325 } 1332 }
1326 1333
1327 void WebContentsImpl::WasShown() { 1334 void WebContentsImpl::WasShown() {
1328 controller_.SetActive(true); 1335 controller_.SetActive(true);
(...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after
5187 dialog_manager_ = dialog_manager; 5194 dialog_manager_ = dialog_manager;
5188 } 5195 }
5189 5196
5190 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5197 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5191 auto it = binding_sets_.find(interface_name); 5198 auto it = binding_sets_.find(interface_name);
5192 if (it != binding_sets_.end()) 5199 if (it != binding_sets_.end())
5193 binding_sets_.erase(it); 5200 binding_sets_.erase(it);
5194 } 5201 }
5195 5202
5196 } // namespace content 5203 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698