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 #include "device/wake_lock/wake_lock_service_context.h" | 5 #include "device/wake_lock/wake_lock_service_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "device/power_save_blocker/power_save_blocker.h" | |
10 #include "device/wake_lock/wake_lock_service_impl.h" | 9 #include "device/wake_lock/wake_lock_service_impl.h" |
11 | 10 |
12 namespace device { | 11 namespace device { |
13 | 12 |
14 WakeLockServiceContext::WakeLockServiceContext( | 13 WakeLockServiceContext::WakeLockServiceContext( |
15 int context_id, | 14 int context_id, |
16 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 15 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
17 const WakeLockContextCallback& native_view_getter) | 16 const WakeLockContextCallback& native_view_getter) |
18 : file_task_runner_(std::move(file_task_runner)), | 17 : file_task_runner_(std::move(file_task_runner)), |
19 context_id_(context_id), | 18 context_id_(context_id), |
20 native_view_getter_(native_view_getter) {} | 19 native_view_getter_(native_view_getter) {} |
21 | 20 |
22 WakeLockServiceContext::~WakeLockServiceContext() {} | 21 WakeLockServiceContext::~WakeLockServiceContext() {} |
23 | 22 |
24 void WakeLockServiceContext::GetWakeLock( | 23 void WakeLockServiceContext::GetWakeLock( |
| 24 mojom::WakeLockType type, |
| 25 mojom::WakeLockReason reason, |
| 26 const std::string& description, |
25 mojom::WakeLockServiceRequest request) { | 27 mojom::WakeLockServiceRequest request) { |
26 // WakeLockServiceImpl owns itself. | 28 // WakeLockServiceImpl owns itself. |
27 new WakeLockServiceImpl(std::move(request), | 29 new WakeLockServiceImpl(std::move(request), type, reason, description, |
28 device::PowerSaveBlocker::PowerSaveBlockerType:: | 30 context_id_, native_view_getter_, file_task_runner_); |
29 kPowerSaveBlockPreventDisplaySleep, | |
30 device::PowerSaveBlocker::Reason::kReasonOther, | |
31 "Wake Lock API", context_id_, native_view_getter_, | |
32 file_task_runner_); | |
33 } | 31 } |
34 | 32 |
35 } // namespace device | 33 } // namespace device |
OLD | NEW |