Chromium Code Reviews| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2997 | 2997 |
| 2998 void WebContentsImpl::OnUpdateFaviconURL( | 2998 void WebContentsImpl::OnUpdateFaviconURL( |
| 2999 const std::vector<FaviconURL>& candidates) { | 2999 const std::vector<FaviconURL>& candidates) { |
| 3000 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3000 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 3001 DidUpdateFaviconURL(candidates)); | 3001 DidUpdateFaviconURL(candidates)); |
| 3002 } | 3002 } |
| 3003 | 3003 |
| 3004 void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, | 3004 void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, |
| 3005 bool has_video, | 3005 bool has_video, |
| 3006 bool has_audio) { | 3006 bool has_audio) { |
| 3007 #if !defined(OS_CHROMEOS) | 3007 // Power save blocking is controlled by the tab audio indicator on desktop |
| 3008 // platforms. | |
| 3009 #if !defined(OS_CHROMEOS) && defined(OS_ANDROID) | |
| 3008 scoped_ptr<PowerSaveBlocker> blocker; | 3010 scoped_ptr<PowerSaveBlocker> blocker; |
| 3009 if (has_video) { | 3011 if (has_video) { |
| 3010 blocker = PowerSaveBlocker::Create( | 3012 blocker = PowerSaveBlocker::Create( |
| 3011 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, "Playing video"); | 3013 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, "Playing video"); |
|
scherkus (not reviewing)
2014/08/21 21:42:55
FYI this is prevent display sleep
| |
| 3012 #if defined(OS_ANDROID) | |
| 3013 static_cast<PowerSaveBlockerImpl*>(blocker.get()) | 3014 static_cast<PowerSaveBlockerImpl*>(blocker.get()) |
| 3014 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); | 3015 ->InitDisplaySleepBlocker(GetView()->GetNativeView()); |
| 3015 #endif | |
| 3016 } else if (has_audio) { | 3016 } else if (has_audio) { |
| 3017 blocker = PowerSaveBlocker::Create( | 3017 blocker = PowerSaveBlocker::Create( |
| 3018 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, "Playing audio"); | 3018 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, "Playing audio"); |
|
scherkus (not reviewing)
2014/08/21 21:42:55
FYI this is the audio-only branch which only preve
miu
2014/08/25 19:34:52
note: It should be perfectly safe to have multiple
| |
| 3019 } | 3019 } |
| 3020 | 3020 |
| 3021 if (blocker) { | 3021 if (blocker) { |
| 3022 uintptr_t key = reinterpret_cast<uintptr_t>(render_frame_message_source_); | 3022 uintptr_t key = reinterpret_cast<uintptr_t>(render_frame_message_source_); |
| 3023 if (!power_save_blockers_.contains(key)) { | 3023 if (!power_save_blockers_.contains(key)) { |
| 3024 power_save_blockers_.add(key, | 3024 power_save_blockers_.add(key, |
| 3025 make_scoped_ptr(new PowerSaveBlockerMapEntry)); | 3025 make_scoped_ptr(new PowerSaveBlockerMapEntry)); |
| 3026 } | 3026 } |
| 3027 PowerSaveBlockerMapEntry* map_entry = | 3027 PowerSaveBlockerMapEntry* map_entry = |
| 3028 power_save_blockers_.get(key); | 3028 power_save_blockers_.get(key); |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4242 node->render_manager()->ResumeResponseDeferredAtStart(); | 4242 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4243 } | 4243 } |
| 4244 | 4244 |
| 4245 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4245 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4246 force_disable_overscroll_content_ = force_disable; | 4246 force_disable_overscroll_content_ = force_disable; |
| 4247 if (view_) | 4247 if (view_) |
| 4248 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4248 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4249 } | 4249 } |
| 4250 | 4250 |
| 4251 } // namespace content | 4251 } // namespace content |
| OLD | NEW |