OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/renderer_host/pepper/pepper_flash_browser_host.h" |
| 6 |
| 7 #include "content/public/browser/browser_ppapi_host.h" |
| 8 #include "ipc/ipc_message_macros.h" |
| 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/host/dispatch_host_message.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/proxy/resource_message_params.h" |
| 13 |
| 14 #ifdef OS_WIN |
| 15 #include <windows.h> |
| 16 #elif defined(OS_MACOSX) |
| 17 #include <CoreServices/CoreServices.h> |
| 18 #endif |
| 19 |
| 20 namespace content { |
| 21 |
| 22 PepperFlashBrowserHost::PepperFlashBrowserHost( |
| 23 BrowserPpapiHost* host, |
| 24 PP_Instance instance, |
| 25 PP_Resource resource) |
| 26 : ResourceHost(host->GetPpapiHost(), instance, resource) { |
| 27 } |
| 28 |
| 29 PepperFlashBrowserHost::~PepperFlashBrowserHost() { |
| 30 } |
| 31 |
| 32 int32_t PepperFlashBrowserHost::OnResourceMessageReceived( |
| 33 const IPC::Message& msg, |
| 34 ppapi::host::HostMessageContext* context) { |
| 35 IPC_BEGIN_MESSAGE_MAP(PepperFlashBrowserHost, msg) |
| 36 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_UpdateActivity, |
| 37 OnMsgUpdateActivity); |
| 38 IPC_END_MESSAGE_MAP() |
| 39 return PP_ERROR_FAILED; |
| 40 } |
| 41 |
| 42 int32_t PepperFlashBrowserHost::OnMsgUpdateActivity( |
| 43 ppapi::host::HostMessageContext* host_context) { |
| 44 #if defined(OS_WIN) |
| 45 // Reading then writing back the same value to the screensaver timeout system |
| 46 // setting resets the countdown which prevents the screensaver from turning |
| 47 // on "for a while". As long as the plugin pings us with this message faster |
| 48 // than the screensaver timeout, it won't go on. |
| 49 int value = 0; |
| 50 if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0)) |
| 51 SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0); |
| 52 #elif defined(OS_MACOSX) |
| 53 UpdateSystemActivity(OverallAct); |
| 54 #else |
| 55 // TODO(brettw) implement this for other platforms. |
| 56 #endif |
| 57 return PP_OK; |
| 58 } |
| 59 |
| 60 } // namespace content |
OLD | NEW |