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