| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PROVIDER_H_ | 5 #ifndef DEVICE_WAKE_LOCK_WAKE_LOCK_PROVIDER_H_ |
| 6 #define DEVICE_WAKE_LOCK_WAKE_LOCK_PROVIDER_H_ | 6 #define DEVICE_WAKE_LOCK_WAKE_LOCK_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" | 10 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" |
| 11 #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" | 11 #include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h" |
| 12 #include "device/wake_lock/wake_lock_service_context.h" | 12 #include "device/wake_lock/wake_lock_context.h" |
| 13 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 | 15 |
| 16 namespace device { | 16 namespace device { |
| 17 | 17 |
| 18 // Serves requests for WakeLockContext connections. | 18 // Serves requests for WakeLockContext connections. |
| 19 class WakeLockProvider : public mojom::WakeLockProvider { | 19 class WakeLockProvider : public mojom::WakeLockProvider { |
| 20 public: | 20 public: |
| 21 WakeLockProvider(scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 21 WakeLockProvider(scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
| 22 const WakeLockContextCallback& native_view_getter); | 22 const WakeLockContextCallback& native_view_getter); |
| 23 ~WakeLockProvider() override; | 23 ~WakeLockProvider() override; |
| 24 | 24 |
| 25 static void Create( | 25 static void Create( |
| 26 mojom::WakeLockProviderRequest request, | 26 mojom::WakeLockProviderRequest request, |
| 27 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 27 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
| 28 const WakeLockContextCallback& native_view_getter); | 28 const WakeLockContextCallback& native_view_getter); |
| 29 | 29 |
| 30 // mojom::WakeLockProvider: | 30 // mojom::WakeLockProvider: |
| 31 void GetWakeLockContextForID( | 31 void GetWakeLockContextForID( |
| 32 int context_id, | 32 int context_id, |
| 33 mojo::InterfaceRequest<mojom::WakeLockContext> request) override; | 33 mojo::InterfaceRequest<mojom::WakeLockContext> request) override; |
| 34 | 34 |
| 35 void GetWakeLockWithoutContext( | 35 void GetWakeLockWithoutContext(mojom::WakeLockType type, |
| 36 mojom::WakeLockType type, | 36 mojom::WakeLockReason reason, |
| 37 mojom::WakeLockReason reason, | 37 const std::string& description, |
| 38 const std::string& description, | 38 mojom::WakeLockRequest request) override; |
| 39 mojom::WakeLockServiceRequest request) override; | |
| 40 | 39 |
| 41 static bool is_in_service_unittest_; | 40 static bool is_in_unittest_; |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 43 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 45 WakeLockContextCallback native_view_getter_; | 44 WakeLockContextCallback native_view_getter_; |
| 46 | 45 |
| 47 DISALLOW_COPY_AND_ASSIGN(WakeLockProvider); | 46 DISALLOW_COPY_AND_ASSIGN(WakeLockProvider); |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace device | 49 } // namespace device |
| 51 | 50 |
| 52 #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_PROVIDER_H_ | 51 #endif // DEVICE_WAKE_LOCK_WAKE_LOCK_PROVIDER_H_ |
| OLD | NEW |