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 CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 5 #ifndef DEVICE_POWER_SAVE_BLOCKER_POWER_SAVE_BLOCKER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 6 #define DEVICE_POWER_SAVE_BLOCKER_POWER_SAVE_BLOCKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "content/common/content_export.h" | 14 #include "device/power_save_blocker/power_save_blocker_export.h" |
15 | 15 |
16 namespace content { | 16 namespace device { |
17 | 17 |
18 // A RAII-style class to block the system from entering low-power (sleep) mode. | 18 // A RAII-style class to block the system from entering low-power (sleep) mode. |
19 // This class is thread-safe; it may be constructed and deleted on any thread. | 19 // This class is thread-safe; it may be constructed and deleted on any thread. |
20 class CONTENT_EXPORT PowerSaveBlocker { | 20 class DEVICE_POWER_SAVE_BLOCKER_EXPORT PowerSaveBlocker { |
21 public: | 21 public: |
22 enum PowerSaveBlockerType { | 22 enum PowerSaveBlockerType { |
23 // Prevent the application from being suspended. On some platforms, apps may | 23 // Prevent the application from being suspended. On some platforms, apps may |
24 // be suspended when they are not visible to the user. This type of block | 24 // be suspended when they are not visible to the user. This type of block |
25 // requests that the app continue to run in that case, and on all platforms | 25 // requests that the app continue to run in that case, and on all platforms |
26 // prevents the system from sleeping. | 26 // prevents the system from sleeping. |
27 // Example use cases: downloading a file, playing audio. | 27 // Example use cases: downloading a file, playing audio. |
28 kPowerSaveBlockPreventAppSuspension, | 28 kPowerSaveBlockPreventAppSuspension, |
29 | 29 |
30 // Prevent the display from going to sleep. This also has the side effect of | 30 // Prevent the display from going to sleep. This also has the side effect of |
(...skipping 21 matching lines...) Expand all Loading... |
52 // the blocking) may be provided to the underlying system APIs on some | 52 // the blocking) may be provided to the underlying system APIs on some |
53 // platforms. | 53 // platforms. |
54 static std::unique_ptr<PowerSaveBlocker> CreateWithTaskRunners( | 54 static std::unique_ptr<PowerSaveBlocker> CreateWithTaskRunners( |
55 PowerSaveBlockerType type, | 55 PowerSaveBlockerType type, |
56 Reason reason, | 56 Reason reason, |
57 const std::string& description, | 57 const std::string& description, |
58 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 58 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
59 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); | 59 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace content | 62 } // namespace device |
63 | 63 |
64 #endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 64 #endif // DEVICE_POWER_SAVE_BLOCKER_POWER_SAVE_BLOCKER_H_ |
OLD | NEW |