Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Side by Side Diff: content/browser/power_save_blocker2.h

Issue 10511021: Add a new version of the power save blocker class, to be implemented for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/content_browser.gypi » ('j') | content/content_browser.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "content/common/content_export.h"
14
15 // A RAII-style class to block the system from entering low-power (sleep) mode.
16 class CONTENT_EXPORT PowerSaveBlocker2 {
rvargas (doing something else) 2012/06/04 23:34:48 ... and I believe this now has to be part of the c
Mike Mammarella 2012/06/05 00:28:42 Done.
17 public:
18 enum PowerSaveBlockerType {
19 // Prevent the application from being suspended. On some platforms, apps may
20 // be suspended when they are not visible to the user. This type of block
21 // requests that the app continue to run in that case, and on all platforms
22 // prevents the system from sleeping.
23 // Example use cases: downloading a file, playing audio.
24 kPowerSaveBlockPreventAppSuspension,
25
26 // Prevent the display from going to sleep. This also has the side effect of
27 // preventing the system from sleeping, but does not necessarily prevent the
28 // app from being suspended on some platforms if the user hides it.
29 // Example use case: playing video.
30 kPowerSaveBlockPreventDisplaySleep,
31 };
32
33 // Pass in the type of power save blocking desired. If multiple types of
34 // blocking are desired, instantiate one PowerSaveBlocker for each type.
35 // |reason| may be provided to the underlying system APIs on some platforms.
36 PowerSaveBlocker2(PowerSaveBlockerType type, const std::string& reason);
37 ~PowerSaveBlocker2();
38
39 private:
40 class Delegate;
41
42 // Implementations of this class may need a second object with different
43 // lifetime than the RAII container, or additional storage. This member is
44 // here for that purpose. If not used, just define the class as an empty
45 // RefCounted like so to make it compile:
46 // class PowerSaveBlocker2::Delegate
47 // : public RefCounted<PowerSaveBlocker2::Delegate> {
48 // };
49 scoped_refptr<PowerSaveBlockerDelegate> delegate;
50
51 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker2);
52 };
53
54 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_
OLDNEW
« no previous file with comments | « no previous file | content/content_browser.gypi » ('j') | content/content_browser.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698