Chromium Code Reviews| Index: device/wake_lock/wake_lock_service_impl.h |
| diff --git a/device/wake_lock/wake_lock_service_impl.h b/device/wake_lock/wake_lock_service_impl.h |
| index c66ec8d1a8fe73c2f111791f007c6f6afb35eafa..56f1032b8ba1b796c85bc7af566e27a6db55498c 100644 |
| --- a/device/wake_lock/wake_lock_service_impl.h |
| +++ b/device/wake_lock/wake_lock_service_impl.h |
| @@ -5,27 +5,61 @@ |
| #ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ |
| #define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ |
| +#include <memory> |
| + |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "device/power_save_blocker/power_save_blocker.h" |
| #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" |
| -#include "mojo/public/cpp/bindings/interface_request.h" |
| +#include "device/wake_lock/wake_lock_service_context.h" |
| +#include "mojo/public/cpp/bindings/binding_set.h" |
| +#include "ui/gfx/native_widget_types.h" |
| namespace device { |
| -class WakeLockServiceContext; |
| - |
| class WakeLockServiceImpl : public mojom::WakeLockService { |
| public: |
| - explicit WakeLockServiceImpl(WakeLockServiceContext* context); |
| + WakeLockServiceImpl( |
| + mojom::WakeLockServiceRequest request, |
| + device::PowerSaveBlocker::PowerSaveBlockerType type, |
| + device::PowerSaveBlocker::Reason reason, |
| + const std::string& description, |
| + int context_id, |
| + WakeLockContextCallback native_view_getter, |
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
| ~WakeLockServiceImpl() override; |
| // WakeLockSevice implementation. |
| void RequestWakeLock() override; |
| void CancelWakeLock() override; |
| + void AddClient(mojom::WakeLockServiceRequest request) override; |
| + void HasWakeLockForTests( |
| + const HasWakeLockForTestsCallback& callback) override; |
| private: |
| - // Will outlive this instance. |
| - WakeLockServiceContext* context_; |
| - bool wake_lock_request_outstanding_; |
| + void UpdateWakeLock(); |
| + void CreateWakeLock(); |
| + void RemoveWakeLock(); |
| + void OnConnectionError(); |
| + |
| + device::PowerSaveBlocker::PowerSaveBlockerType type_; |
| + device::PowerSaveBlocker::Reason reason_; |
| + std::unique_ptr<std::string> description_; |
| + int num_lock_requests_; |
| + |
| +#if defined(OS_ANDROID) |
| + int context_id_; |
| + WakeLockContextCallback native_view_getter_; |
| +#endif |
| + |
| + scoped_refptr<base::SequencedTaskRunner> main_task_runner_; |
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| + |
| + // The actual power save blocker for screen. |
| + std::unique_ptr<PowerSaveBlocker> wake_lock_; |
| + |
| + mojo::BindingSet<mojom::WakeLockService, std::unique_ptr<bool>> binding_set_; |
|
Ken Rockot(use gerrit already)
2017/05/05 17:55:31
Please document the meaning of the context here in
ke.he
2017/05/06 03:08:44
Done.
|
| DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl); |
| }; |