Chromium Code Reviews| Index: content/browser/power_save_blocker2.h |
| =================================================================== |
| --- content/browser/power_save_blocker2.h (revision 0) |
| +++ content/browser/power_save_blocker2.h (revision 0) |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
| +#define CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "content/common/content_export.h" |
| + |
| +// A RAII-style class to block the system from entering low-power (sleep) mode. |
| +class CONTENT_EXPORT PowerSaveBlocker2 { |
| + public: |
| + enum PowerSaveBlockerType { |
| + // Prevent the application from being suspended. On some platforms, apps may |
| + // be suspended when they are not visible to the user. This type of block |
| + // requests that the app continue to run in that case, and on all platforms |
| + // prevents the system from sleeping. |
| + // Example use cases: downloading a file, playing audio. |
| + kPowerSaveBlockPreventAppSuspension, |
| + |
| + // Prevent the display from going to sleep. This also has the side effect of |
| + // preventing the system from sleeping, but does not necessarily prevent the |
| + // app from being suspended on some platforms if the user hides it. |
| + // Example use case: playing video. |
| + kPowerSaveBlockPreventDisplaySleep, |
| + }; |
| + |
| + // Pass in the type of power save blocking desired. If multiple types of |
| + // blocking are desired, instantiate one PowerSaveBlocker for each type. |
| + explicit PowerSaveBlocker2(PowerSaveBlockerType type); |
|
Avi (use Gerrit)
2012/06/04 21:58:52
Can we get a string to describe why?
Mike Mammarella
2012/06/04 22:21:28
Done.
|
| + ~PowerSaveBlocker2(); |
| + |
| + private: |
| + class PowerSaveBlockerImpl; |
| + |
| + // Implementations of this class may need a second object with different |
| + // lifetime than the RAII container, or additional storage. This member is |
| + // here for that purpose. |
| + PowerSaveBlockerImpl* impl; |
|
Avi (use Gerrit)
2012/06/04 21:58:52
Huh. I was going to go for #ifdef-ed member variab
Mike Mammarella
2012/06/04 22:21:28
We could do that too I suppose. In the Linux versi
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker2); |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ |
| Property changes on: content/browser/power_save_blocker2.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |