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

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

Issue 2483843002: Revert of [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/page_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 audio_muter_.reset(new WebContentsAudioMuter(this)); 1252 audio_muter_.reset(new WebContentsAudioMuter(this));
1253 audio_muter_->StartMuting(); 1253 audio_muter_->StartMuting();
1254 } else { 1254 } else {
1255 DCHECK(audio_muter_); 1255 DCHECK(audio_muter_);
1256 audio_muter_->StopMuting(); 1256 audio_muter_->StopMuting();
1257 } 1257 }
1258 1258
1259 for (auto& observer : observers_) 1259 for (auto& observer : observers_)
1260 observer.DidUpdateAudioMutingState(mute); 1260 observer.DidUpdateAudioMutingState(mute);
1261 1261
1262 OnAudioStateChanged(!mute && audio_stream_monitor_.IsCurrentlyAudible()); 1262 // Notification for UI updates in response to the changed muting state.
1263 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1263 } 1264 }
1264 1265
1265 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { 1266 bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
1266 return bluetooth_connected_device_count_ > 0; 1267 return bluetooth_connected_device_count_ > 0;
1267 } 1268 }
1268 1269
1269 bool WebContentsImpl::IsCrashed() const { 1270 bool WebContentsImpl::IsCrashed() const {
1270 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1271 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1271 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1272 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
1272 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 1273 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 media_web_contents_observer_->MaybeUpdateAudibleState(); 1313 media_web_contents_observer_->MaybeUpdateAudibleState();
1313 } 1314 }
1314 1315
1315 if (delegate_) 1316 if (delegate_)
1316 delegate_->NavigationStateChanged(this, changed_flags); 1317 delegate_->NavigationStateChanged(this, changed_flags);
1317 1318
1318 if (GetOuterWebContents()) 1319 if (GetOuterWebContents())
1319 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags); 1320 GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags);
1320 } 1321 }
1321 1322
1322 void WebContentsImpl::OnAudioStateChanged(bool is_audio_playing) {
1323 SendPageMessage(
1324 new PageMsg_AudioStateChanged(MSG_ROUTING_NONE, is_audio_playing));
1325
1326 // Notification for UI updates in response to the changed muting state.
1327 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1328 }
1329
1330 base::TimeTicks WebContentsImpl::GetLastActiveTime() const { 1323 base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
1331 return last_active_time_; 1324 return last_active_time_;
1332 } 1325 }
1333 1326
1334 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) { 1327 void WebContentsImpl::SetLastActiveTime(base::TimeTicks last_active_time) {
1335 last_active_time_ = last_active_time; 1328 last_active_time_ = last_active_time;
1336 } 1329 }
1337 1330
1338 base::TimeTicks WebContentsImpl::GetLastHiddenTime() const { 1331 base::TimeTicks WebContentsImpl::GetLastHiddenTime() const {
1339 return last_hidden_time_; 1332 return last_hidden_time_;
(...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after
5198 dialog_manager_ = dialog_manager; 5191 dialog_manager_ = dialog_manager;
5199 } 5192 }
5200 5193
5201 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5194 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5202 auto it = binding_sets_.find(interface_name); 5195 auto it = binding_sets_.find(interface_name);
5203 if (it != binding_sets_.end()) 5196 if (it != binding_sets_.end())
5204 binding_sets_.erase(it); 5197 binding_sets_.erase(it);
5205 } 5198 }
5206 5199
5207 } // namespace content 5200 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/page_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698