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 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3240 } | 3240 } |
3241 | 3241 |
3242 void WebContentsImpl::CreateVideoPowerSaveBlocker() { | 3242 void WebContentsImpl::CreateVideoPowerSaveBlocker() { |
3243 DCHECK(!video_power_save_blocker_); | 3243 DCHECK(!video_power_save_blocker_); |
3244 DCHECK(!active_video_players_.empty()); | 3244 DCHECK(!active_video_players_.empty()); |
3245 video_power_save_blocker_ = PowerSaveBlocker::Create( | 3245 video_power_save_blocker_ = PowerSaveBlocker::Create( |
3246 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 3246 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
3247 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); | 3247 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); |
3248 #if defined(OS_ANDROID) | 3248 #if defined(OS_ANDROID) |
3249 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) | 3249 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) |
3250 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); | 3250 ->InitDisplaySleepBlocker(this); |
3251 #endif | 3251 #endif |
3252 } | 3252 } |
3253 | 3253 |
3254 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { | 3254 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { |
3255 // If there are no more audio players and we don't have audio stream | 3255 // If there are no more audio players and we don't have audio stream |
3256 // monitoring, release the audio power save blocker here instead of during | 3256 // monitoring, release the audio power save blocker here instead of during |
3257 // NotifyNavigationStateChanged(). | 3257 // NotifyNavigationStateChanged(). |
3258 if (active_audio_players_.empty() && | 3258 if (active_audio_players_.empty() && |
3259 !audio_state_provider_->IsAudioStateAvailable()) { | 3259 !audio_state_provider_->IsAudioStateAvailable()) { |
3260 audio_power_save_blocker_.reset(); | 3260 audio_power_save_blocker_.reset(); |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 node->render_manager()->ResumeResponseDeferredAtStart(); | 4586 node->render_manager()->ResumeResponseDeferredAtStart(); |
4587 } | 4587 } |
4588 | 4588 |
4589 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4589 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4590 force_disable_overscroll_content_ = force_disable; | 4590 force_disable_overscroll_content_ = force_disable; |
4591 if (view_) | 4591 if (view_) |
4592 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4592 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4593 } | 4593 } |
4594 | 4594 |
4595 } // namespace content | 4595 } // namespace content |
OLD | NEW |