| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 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/sequenced_task_runner.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 13 #include "content/public/browser/power_save_blocker.h" | 15 #include "content/public/browser/power_save_blocker.h" |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 class WebContents; | 19 class WebContents; |
| 18 | 20 |
| 19 class PowerSaveBlockerImpl : public PowerSaveBlocker { | 21 class PowerSaveBlockerImpl : public PowerSaveBlocker { |
| 20 public: | 22 public: |
| 21 PowerSaveBlockerImpl(PowerSaveBlockerType type, | 23 PowerSaveBlockerImpl( |
| 22 Reason reason, | 24 PowerSaveBlockerType type, |
| 23 const std::string& description); | 25 Reason reason, |
| 26 const std::string& description, |
| 27 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 28 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner); |
| 24 ~PowerSaveBlockerImpl() override; | 29 ~PowerSaveBlockerImpl() override; |
| 25 | 30 |
| 26 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
| 27 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of | 32 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of |
| 28 // PowerSaveBlocker should associated with a WebContents, so the blocker | 33 // PowerSaveBlocker should associated with a WebContents, so the blocker |
| 29 // could be removed by platform if the WebContents is hidden. | 34 // could be removed by platform if the WebContents is hidden. |
| 30 void InitDisplaySleepBlocker(WebContents* web_contents); | 35 void InitDisplaySleepBlocker(WebContents* web_contents); |
| 31 #endif | 36 #endif |
| 32 | 37 |
| 33 private: | 38 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 45 // }; | 50 // }; |
| 46 scoped_refptr<Delegate> delegate_; | 51 scoped_refptr<Delegate> delegate_; |
| 47 | 52 |
| 48 #if defined(USE_X11) | 53 #if defined(USE_X11) |
| 49 // Since display sleep prevention also implies system suspend prevention, for | 54 // Since display sleep prevention also implies system suspend prevention, for |
| 50 // the Linux FreeDesktop API case, there needs to be a second delegate to | 55 // the Linux FreeDesktop API case, there needs to be a second delegate to |
| 51 // block system suspend when screen saver / display sleep is blocked. | 56 // block system suspend when screen saver / display sleep is blocked. |
| 52 scoped_refptr<Delegate> freedesktop_suspend_delegate_; | 57 scoped_refptr<Delegate> freedesktop_suspend_delegate_; |
| 53 #endif | 58 #endif |
| 54 | 59 |
| 60 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 61 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 62 |
| 55 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); | 63 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); |
| 56 }; | 64 }; |
| 57 | 65 |
| 58 } // namespace content | 66 } // namespace content |
| 59 | 67 |
| 60 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 68 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ |
| OLD | NEW |