| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |