OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ | 5 #ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ |
6 #define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ | 6 #define DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | |
10 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" | 9 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" |
11 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
12 | 11 |
13 namespace device { | 12 namespace device { |
14 | 13 |
15 class WakeLockServiceContext; | 14 class WakeLockServiceContext; |
16 | 15 |
17 class WakeLockServiceImpl : public mojom::WakeLockService { | 16 class WakeLockServiceImpl : public mojom::WakeLockService { |
18 public: | 17 public: |
19 explicit WakeLockServiceImpl(base::WeakPtr<WakeLockServiceContext> context); | 18 explicit WakeLockServiceImpl(WakeLockServiceContext* context); |
20 ~WakeLockServiceImpl() override; | 19 ~WakeLockServiceImpl() override; |
21 | 20 |
22 // WakeLockSevice implementation. | 21 // WakeLockSevice implementation. |
23 void RequestWakeLock() override; | 22 void RequestWakeLock() override; |
24 void CancelWakeLock() override; | 23 void CancelWakeLock() override; |
25 | 24 |
26 private: | 25 private: |
27 base::WeakPtr<WakeLockServiceContext> context_; | 26 // Will outlive this instance. |
| 27 WakeLockServiceContext* context_; |
28 bool wake_lock_request_outstanding_; | 28 bool wake_lock_request_outstanding_; |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl); | 30 DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImpl); |
31 }; | 31 }; |
32 | 32 |
33 } // namespace device | 33 } // namespace device |
34 | 34 |
35 #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ | 35 #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_ |
OLD | NEW |