refactor: use public WakeLock interface (#15351)

* refactor: use public WakeLock interface

* remove power_save_blocker visibility patch
This commit is contained in:
Jeremy Apthorp 2018-10-23 22:12:58 -07:00 committed by Shelley Vohr
parent 1f246229b1
commit 1d8ab03146
5 changed files with 52 additions and 67 deletions

View file

@ -10,7 +10,7 @@
#include "atom/browser/api/trackable_object.h"
#include "native_mate/handle.h"
#include "services/device/wake_lock/power_save_blocker/power_save_blocker.h"
#include "services/device/public/mojom/wake_lock.mojom.h"
namespace mate {
class Dictionary;
@ -37,14 +37,19 @@ class PowerSaveBlocker : public mate::TrackableObject<PowerSaveBlocker> {
bool Stop(int id);
bool IsStarted(int id);
std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_;
device::mojom::WakeLock* GetWakeLock();
// Current blocker type used by |power_save_blocker_|
device::mojom::WakeLockType current_blocker_type_;
// Current wake lock level.
device::mojom::WakeLockType current_lock_type_;
// Whether the wake lock is currently active.
bool is_wake_lock_active_;
// Map from id to the corresponding blocker type for each request.
using WakeLockTypeMap = std::map<int, device::mojom::WakeLockType>;
WakeLockTypeMap power_save_blocker_types_;
WakeLockTypeMap wake_lock_types_;
device::mojom::WakeLockPtr wake_lock_;
DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker);
};