| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3213 } | 3213 } |
| 3214 | 3214 |
| 3215 void WebContentsImpl::CreateVideoPowerSaveBlocker() { | 3215 void WebContentsImpl::CreateVideoPowerSaveBlocker() { |
| 3216 DCHECK(!video_power_save_blocker_); | 3216 DCHECK(!video_power_save_blocker_); |
| 3217 DCHECK(!active_video_players_.empty()); | 3217 DCHECK(!active_video_players_.empty()); |
| 3218 video_power_save_blocker_ = PowerSaveBlocker::Create( | 3218 video_power_save_blocker_ = PowerSaveBlocker::Create( |
| 3219 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 3219 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 3220 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); | 3220 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); |
| 3221 #if defined(OS_ANDROID) | 3221 #if defined(OS_ANDROID) |
| 3222 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) | 3222 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) |
| 3223 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); | 3223 ->InitDisplaySleepBlocker(this); |
| 3224 #endif | 3224 #endif |
| 3225 } | 3225 } |
| 3226 | 3226 |
| 3227 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { | 3227 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { |
| 3228 // If there are no more audio players and we don't have audio stream | 3228 // If there are no more audio players and we don't have audio stream |
| 3229 // monitoring, release the audio power save blocker here instead of during | 3229 // monitoring, release the audio power save blocker here instead of during |
| 3230 // NotifyNavigationStateChanged(). | 3230 // NotifyNavigationStateChanged(). |
| 3231 if (active_audio_players_.empty() && | 3231 if (active_audio_players_.empty() && |
| 3232 !audio_state_provider_->IsAudioStateAvailable()) { | 3232 !audio_state_provider_->IsAudioStateAvailable()) { |
| 3233 audio_power_save_blocker_.reset(); | 3233 audio_power_save_blocker_.reset(); |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4559 node->render_manager()->ResumeResponseDeferredAtStart(); | 4559 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4560 } | 4560 } |
| 4561 | 4561 |
| 4562 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4562 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4563 force_disable_overscroll_content_ = force_disable; | 4563 force_disable_overscroll_content_ = force_disable; |
| 4564 if (view_) | 4564 if (view_) |
| 4565 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4565 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4566 } | 4566 } |
| 4567 | 4567 |
| 4568 } // namespace content | 4568 } // namespace content |
| OLD | NEW |