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 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 image_download_map_.erase(id); | 3155 image_download_map_.erase(id); |
3156 } | 3156 } |
3157 | 3157 |
3158 void WebContentsImpl::OnUpdateFaviconURL( | 3158 void WebContentsImpl::OnUpdateFaviconURL( |
3159 const std::vector<FaviconURL>& candidates) { | 3159 const std::vector<FaviconURL>& candidates) { |
3160 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3160 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3161 DidUpdateFaviconURL(candidates)); | 3161 DidUpdateFaviconURL(candidates)); |
3162 } | 3162 } |
3163 | 3163 |
3164 void WebContentsImpl::CreateAudioPowerSaveBlocker() { | 3164 void WebContentsImpl::CreateAudioPowerSaveBlocker() { |
3165 // ChromeOS has its own way of handling power save blocks for media. | |
3166 #if !defined(OS_CHROMEOS) | |
3167 DCHECK(!audio_power_save_blocker_); | 3165 DCHECK(!audio_power_save_blocker_); |
3168 audio_power_save_blocker_ = PowerSaveBlocker::Create( | 3166 audio_power_save_blocker_ = PowerSaveBlocker::Create( |
3169 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, "Playing Audio"); | 3167 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
3170 #endif | 3168 PowerSaveBlocker::kReasonAudioPlayback, "Playing audio"); |
3171 } | 3169 } |
3172 | 3170 |
3173 void WebContentsImpl::CreateVideoPowerSaveBlocker() { | 3171 void WebContentsImpl::CreateVideoPowerSaveBlocker() { |
3174 // ChromeOS has its own way of handling power save blocks for media. | |
3175 #if !defined(OS_CHROMEOS) | |
3176 DCHECK(!video_power_save_blocker_); | 3172 DCHECK(!video_power_save_blocker_); |
3177 DCHECK(!active_video_players_.empty()); | 3173 DCHECK(!active_video_players_.empty()); |
3178 video_power_save_blocker_ = PowerSaveBlocker::Create( | 3174 video_power_save_blocker_ = PowerSaveBlocker::Create( |
3179 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, "Playing Video"); | 3175 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 3176 PowerSaveBlocker::kReasonVideoPlayback, "Playing video"); |
3180 #if defined(OS_ANDROID) | 3177 #if defined(OS_ANDROID) |
3181 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) | 3178 static_cast<PowerSaveBlockerImpl*>(video_power_save_blocker_.get()) |
3182 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); | 3179 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); |
3183 #endif | 3180 #endif |
3184 #endif | |
3185 } | 3181 } |
3186 | 3182 |
3187 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { | 3183 void WebContentsImpl::MaybeReleasePowerSaveBlockers() { |
3188 // If there are no more audio players and we don't have audio stream | 3184 // If there are no more audio players and we don't have audio stream |
3189 // monitoring, release the audio power save blocker here instead of during | 3185 // monitoring, release the audio power save blocker here instead of during |
3190 // NotifyNavigationStateChanged(). | 3186 // NotifyNavigationStateChanged(). |
3191 if (active_audio_players_.empty() && | 3187 if (active_audio_players_.empty() && |
3192 !AudioStreamMonitor::monitoring_available()) { | 3188 !AudioStreamMonitor::monitoring_available()) { |
3193 audio_power_save_blocker_.reset(); | 3189 audio_power_save_blocker_.reset(); |
3194 } | 3190 } |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4514 node->render_manager()->ResumeResponseDeferredAtStart(); | 4510 node->render_manager()->ResumeResponseDeferredAtStart(); |
4515 } | 4511 } |
4516 | 4512 |
4517 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4513 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4518 force_disable_overscroll_content_ = force_disable; | 4514 force_disable_overscroll_content_ = force_disable; |
4519 if (view_) | 4515 if (view_) |
4520 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4516 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4521 } | 4517 } |
4522 | 4518 |
4523 } // namespace content | 4519 } // namespace content |
OLD | NEW |