diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 06:25:17 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 06:25:17 +0000 |
commit | 2b67216b16aa4610b7b65835b0b2ae0b462c0eed (patch) | |
tree | 550007ecc4fff13fbd0d0c18bba17f388be02cd0 /content/public/browser/power_save_blocker.h | |
parent | ca1d8f72d5a3ba5ab084ce43d8bd0d437363e725 (diff) | |
download | chromium_src-2b67216b16aa4610b7b65835b0b2ae0b462c0eed.zip chromium_src-2b67216b16aa4610b7b65835b0b2ae0b462c0eed.tar.gz chromium_src-2b67216b16aa4610b7b65835b0b2ae0b462c0eed.tar.bz2 |
Make content::PowerSaveBlocker public
BUG=152207
Review URL: https://chromiumcodereview.appspot.com/11784016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/browser/power_save_blocker.h')
-rw-r--r-- | content/public/browser/power_save_blocker.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/content/public/browser/power_save_blocker.h b/content/public/browser/power_save_blocker.h new file mode 100644 index 0000000..fe9f966 --- /dev/null +++ b/content/public/browser/power_save_blocker.h @@ -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_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ +#define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ + +#include <string> + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "content/common/content_export.h" + +namespace content { + +// A RAII-style class to block the system from entering low-power (sleep) mode. +// This class is thread-safe; it may be constructed and deleted on any thread. +class CONTENT_EXPORT PowerSaveBlocker { + 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, + }; + + virtual ~PowerSaveBlocker() = 0; + + // Pass in the type of power save blocking desired. If multiple types of + // blocking are desired, instantiate one PowerSaveBlocker for each type. + // |reason| may be provided to the underlying system APIs on some platforms. + static scoped_ptr<PowerSaveBlocker> Create(PowerSaveBlockerType type, + const std::string& reason); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |