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 DEVICE_POWER_SAVE_BLOCKER_POWER_SAVE_BLOCKER_IMPL_H_ |
6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 6 #define DEVICE_POWER_SAVE_BLOCKER_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/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/public/browser/power_save_blocker.h" | 16 #include "device/power_save_blocker/power_save_blocker.h" |
| 17 #include "device/power_save_blocker/power_save_blocker_export.h" |
17 | 18 |
18 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
19 #include "ui/android/view_android.h" | 20 #include "ui/android/view_android.h" |
20 #endif // OS_ANDROID | 21 #endif // OS_ANDROID |
21 | 22 |
22 namespace content { | 23 namespace device { |
23 | 24 |
24 class WebContents; | 25 class WebContents; |
25 | 26 |
26 class PowerSaveBlockerImpl : public PowerSaveBlocker { | 27 class PowerSaveBlockerImpl : public PowerSaveBlocker { |
27 public: | 28 public: |
28 PowerSaveBlockerImpl( | 29 PowerSaveBlockerImpl( |
29 PowerSaveBlockerType type, | 30 PowerSaveBlockerType type, |
30 Reason reason, | 31 Reason reason, |
31 const std::string& description, | 32 const std::string& description, |
32 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 33 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
33 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner); | 34 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner); |
34 ~PowerSaveBlockerImpl() override; | 35 ~PowerSaveBlockerImpl() override; |
35 | 36 |
36 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
37 // On Android, the kPowerSaveBlockPreventDisplaySleep type of | 38 // On Android, the kPowerSaveBlockPreventDisplaySleep type of |
38 // PowerSaveBlocker should associated with a View, so the blocker can be | 39 // PowerSaveBlocker should associated with a View, so the blocker can be |
39 // removed by the platform. | 40 // removed by the platform. |
40 void InitDisplaySleepBlocker( | 41 DEVICE_POWER_SAVE_BLOCKER_EXPORT void InitDisplaySleepBlocker( |
41 const base::WeakPtr<ui::ViewAndroid>& view_android); | 42 const base::WeakPtr<ui::ViewAndroid>& view_android); |
42 #endif | 43 #endif |
43 | 44 |
44 private: | 45 private: |
45 class Delegate; | 46 class Delegate; |
46 | 47 |
47 // Implementations of this class may need a second object with different | 48 // Implementations of this class may need a second object with different |
48 // lifetime than the RAII container, or additional storage. This member is | 49 // lifetime than the RAII container, or additional storage. This member is |
49 // here for that purpose. If not used, just define the class as an empty | 50 // here for that purpose. If not used, just define the class as an empty |
50 // RefCounted (or RefCountedThreadSafe) like so to make it compile: | 51 // RefCounted (or RefCountedThreadSafe) like so to make it compile: |
(...skipping 11 matching lines...) Expand all Loading... |
62 // block system suspend when screen saver / display sleep is blocked. | 63 // block system suspend when screen saver / display sleep is blocked. |
63 scoped_refptr<Delegate> freedesktop_suspend_delegate_; | 64 scoped_refptr<Delegate> freedesktop_suspend_delegate_; |
64 #endif | 65 #endif |
65 | 66 |
66 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 67 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
67 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 68 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); | 70 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); |
70 }; | 71 }; |
71 | 72 |
72 } // namespace content | 73 } // namespace device |
73 | 74 |
74 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 75 #endif // DEVICE_POWER_SAVE_BLOCKER_POWER_SAVE_BLOCKER_IMPL_H_ |
OLD | NEW |