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 #ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/timer/timer.h" |
13 #include "ppapi/host/host_message_context.h" | 14 #include "ppapi/host/host_message_context.h" |
14 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class Time; | 18 class Time; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 class BrowserPpapiHost; | 22 class BrowserPpapiHost; |
22 class ResourceContext; | 23 class ResourceContext; |
23 } | 24 } |
24 | 25 |
25 namespace content_settings { | 26 namespace content_settings { |
26 class CookieSettings; | 27 class CookieSettings; |
27 } | 28 } |
28 | 29 |
| 30 namespace device { |
| 31 class PowerSaveBlocker; |
| 32 } |
| 33 |
29 class GURL; | 34 class GURL; |
30 | 35 |
31 namespace chrome { | 36 namespace chrome { |
32 | 37 |
33 class PepperFlashBrowserHost : public ppapi::host::ResourceHost { | 38 class PepperFlashBrowserHost : public ppapi::host::ResourceHost { |
34 public: | 39 public: |
35 PepperFlashBrowserHost(content::BrowserPpapiHost* host, | 40 PepperFlashBrowserHost(content::BrowserPpapiHost* host, |
36 PP_Instance instance, | 41 PP_Instance instance, |
37 PP_Resource resource); | 42 PP_Resource resource); |
38 ~PepperFlashBrowserHost() override; | 43 ~PepperFlashBrowserHost() override; |
39 | 44 |
40 // ppapi::host::ResourceHost override. | 45 // ppapi::host::ResourceHost override. |
41 int32_t OnResourceMessageReceived( | 46 int32_t OnResourceMessageReceived( |
42 const IPC::Message& msg, | 47 const IPC::Message& msg, |
43 ppapi::host::HostMessageContext* context) override; | 48 ppapi::host::HostMessageContext* context) override; |
44 | 49 |
45 private: | 50 private: |
| 51 void OnDelayTimerFired(); |
46 int32_t OnUpdateActivity(ppapi::host::HostMessageContext* host_context); | 52 int32_t OnUpdateActivity(ppapi::host::HostMessageContext* host_context); |
47 int32_t OnGetLocalTimeZoneOffset( | 53 int32_t OnGetLocalTimeZoneOffset( |
48 ppapi::host::HostMessageContext* host_context, | 54 ppapi::host::HostMessageContext* host_context, |
49 const base::Time& t); | 55 const base::Time& t); |
50 int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context); | 56 int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context); |
51 | 57 |
52 void GetLocalDataRestrictions( | 58 void GetLocalDataRestrictions( |
53 ppapi::host::ReplyMessageContext reply_context, | 59 ppapi::host::ReplyMessageContext reply_context, |
54 const GURL& document_url, | 60 const GURL& document_url, |
55 const GURL& plugin_url, | 61 const GURL& plugin_url, |
56 scoped_refptr<content_settings::CookieSettings> cookie_settings); | 62 scoped_refptr<content_settings::CookieSettings> cookie_settings); |
57 | 63 |
58 content::BrowserPpapiHost* host_; | 64 content::BrowserPpapiHost* host_; |
59 int render_process_id_; | 65 int render_process_id_; |
| 66 |
| 67 // A power save blocker to prevent going to sleep, and a timer to destroy it |
| 68 // after a certain amount of time has elapsed without an UpdateActivity. |
| 69 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; |
| 70 base::DelayTimer delay_timer_; |
| 71 |
60 // For fetching the Flash LSO settings. | 72 // For fetching the Flash LSO settings. |
61 scoped_refptr<content_settings::CookieSettings> cookie_settings_; | 73 scoped_refptr<content_settings::CookieSettings> cookie_settings_; |
62 base::WeakPtrFactory<PepperFlashBrowserHost> weak_factory_; | 74 base::WeakPtrFactory<PepperFlashBrowserHost> weak_factory_; |
63 | 75 |
64 DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost); | 76 DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHost); |
65 }; | 77 }; |
66 | 78 |
67 } // namespace chrome | 79 } // namespace chrome |
68 | 80 |
69 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ | 81 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_ |
OLD | NEW |