OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
| 6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 // A RAII-style class to block the system from entering low-power (sleep) mode. |
| 15 class CONTENT_EXPORT PowerSaveBlocker2 { |
| 16 public: |
| 17 enum PowerSaveBlockerType { |
| 18 // Prevent the application from being suspended. On some platforms, apps may |
| 19 // be suspended when they are not visible to the user. This type of block |
| 20 // requests that the app continue to run in that case, and on all platforms |
| 21 // prevents the system from sleeping. |
| 22 // Example use cases: downloading a file, playing audio. |
| 23 kPowerSaveBlockPreventAppSuspension, |
| 24 |
| 25 // Prevent the display from going to sleep. This also has the side effect of |
| 26 // preventing the system from sleeping, but does not necessarily prevent the |
| 27 // app from being suspended on some platforms if the user hides it. |
| 28 // Example use case: playing video. |
| 29 kPowerSaveBlockPreventDisplaySleep, |
| 30 }; |
| 31 |
| 32 // Pass in the type of power save blocking desired. If multiple types of |
| 33 // blocking are desired, instantiate one PowerSaveBlocker for each type. |
| 34 explicit PowerSaveBlocker2(PowerSaveBlockerType type); |
| 35 ~PowerSaveBlocker2(); |
| 36 |
| 37 private: |
| 38 class PowerSaveBlockerImpl; |
| 39 |
| 40 // Implementations of this class may need a second object with different |
| 41 // lifetime than the RAII container, or additional storage. This member is |
| 42 // here for that purpose. |
| 43 PowerSaveBlockerImpl* impl; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker2); |
| 46 }; |
| 47 |
| 48 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
OLD | NEW |