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

Side by Side Diff: chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc

Issue 2462243004: Flash: On activity, prevent display sleep, not just system sleep (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" 5 #include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/content_settings/cookie_settings_factory.h" 9 #include "chrome/browser/content_settings/cookie_settings_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 void PepperFlashBrowserHost::OnDelayTimerFired() { 84 void PepperFlashBrowserHost::OnDelayTimerFired() {
85 power_save_blocker_.reset(); 85 power_save_blocker_.reset();
86 } 86 }
87 87
88 int32_t PepperFlashBrowserHost::OnUpdateActivity( 88 int32_t PepperFlashBrowserHost::OnUpdateActivity(
89 ppapi::host::HostMessageContext* host_context) { 89 ppapi::host::HostMessageContext* host_context) {
90 if (!power_save_blocker_) { 90 if (!power_save_blocker_) {
91 power_save_blocker_.reset(new device::PowerSaveBlocker( 91 power_save_blocker_.reset(new device::PowerSaveBlocker(
92 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 92 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
93 device::PowerSaveBlocker::kReasonOther, "Requested By PepperFlash", 93 device::PowerSaveBlocker::kReasonOther, "Requested By PepperFlash",
94 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), 94 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
95 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); 95 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
96 } 96 }
97 // There is no specification for how long OnUpdateActivity should prevent the 97 // There is no specification for how long OnUpdateActivity should prevent the
98 // screen from going to sleep. Empirically, twitch.tv calls this method every 98 // screen from going to sleep. Empirically, twitch.tv calls this method every
99 // 10 seconds. Be conservative and allow 45 seconds (set in |delay_timer_|'s 99 // 10 seconds. Be conservative and allow 45 seconds (set in |delay_timer_|'s
100 // ctor) before deleting the block. 100 // ctor) before deleting the block.
101 delay_timer_.Reset(); 101 delay_timer_.Reset();
102 return PP_OK; 102 return PP_OK;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 restrictions = PP_FLASHLSORESTRICTIONS_BLOCK; 163 restrictions = PP_FLASHLSORESTRICTIONS_BLOCK;
164 else if (cookie_settings_->IsCookieSessionOnly(plugin_url)) 164 else if (cookie_settings_->IsCookieSessionOnly(plugin_url))
165 restrictions = PP_FLASHLSORESTRICTIONS_IN_MEMORY; 165 restrictions = PP_FLASHLSORESTRICTIONS_IN_MEMORY;
166 } 166 }
167 SendReply(reply_context, 167 SendReply(reply_context,
168 PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply( 168 PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply(
169 static_cast<int32_t>(restrictions))); 169 static_cast<int32_t>(restrictions)));
170 } 170 }
171 171
172 } // namespace chrome 172 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698