| 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 CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // A RAII-style class to block the system from entering low-power (sleep) mode. | 15 // A RAII-style class to block the system from entering low-power (sleep) mode. |
| 16 // This class is thread-safe; it may be constructed and deleted on any thread. | 16 // This class is thread-safe; it may be constructed and deleted on any thread. |
| 17 class CONTENT_EXPORT PowerSaveBlocker { | 17 class CONTENT_EXPORT PowerSaveBlocker { |
| 18 public: | 18 public: |
| 19 enum PowerSaveBlockerType { | 19 enum PowerSaveBlockerType { |
| 20 // Prevent the application from being suspended. On some platforms, apps may | 20 // Prevent the application from being suspended. On some platforms, apps may |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 kReasonOther, | 41 kReasonOther, |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 virtual ~PowerSaveBlocker() = 0; | 44 virtual ~PowerSaveBlocker() = 0; |
| 45 | 45 |
| 46 // Pass in the type of power save blocking desired. If multiple types of | 46 // Pass in the type of power save blocking desired. If multiple types of |
| 47 // blocking are desired, instantiate one PowerSaveBlocker for each type. | 47 // blocking are desired, instantiate one PowerSaveBlocker for each type. |
| 48 // |reason| and |description| (a more-verbose, human-readable justification of | 48 // |reason| and |description| (a more-verbose, human-readable justification of |
| 49 // the blocking) may be provided to the underlying system APIs on some | 49 // the blocking) may be provided to the underlying system APIs on some |
| 50 // platforms. | 50 // platforms. |
| 51 static scoped_ptr<PowerSaveBlocker> Create(PowerSaveBlockerType type, | 51 static std::unique_ptr<PowerSaveBlocker> Create( |
| 52 Reason reason, | 52 PowerSaveBlockerType type, |
| 53 const std::string& description); | 53 Reason reason, |
| 54 const std::string& description); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace content | 57 } // namespace content |
| 57 | 58 |
| 58 #endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 59 #endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
| OLD | NEW |