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