OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_CONTEXT_HOST_H_ | |
6 #define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_CONTEXT_HOST_H_ | |
7 | |
8 #include "content/public/browser/web_contents.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" | |
11 #include "ui/gfx/native_widget_types.h" | |
12 | |
13 namespace content { | |
14 | |
15 // On Android, WakeLockContext requires the NativeView associated with the | |
16 // context in order to lock the screen. WakeLockContextHost provides this | |
17 // functionality by mapping WakeLockContext IDs to the WebContents associated | |
18 // with those IDs. | |
19 class WakeLockContextHost { | |
20 public: | |
21 WakeLockContextHost(WebContents* web_contents); | |
dcheng
2017/03/17 06:55:26
Nit: explicit
blundell
2017/03/17 12:28:21
Done.
| |
22 ~WakeLockContextHost(); | |
23 | |
24 // This callback is passed into the DeviceService constructor in order to | |
25 // enable WakeLockContext to map a context ID to a Native View as necessary. | |
26 static gfx::NativeView GetNativeViewForContext(int context_id); | |
27 | |
28 // Returns the WakeLockContext* to which this instance is connected. | |
29 device::mojom::WakeLockContext* GetWakeLockContext() { | |
30 return wake_lock_context_.get(); | |
31 } | |
32 | |
33 private: | |
34 // This instance's ID. | |
35 int id_; | |
36 | |
37 // The WebContents that owns this instance. | |
38 WebContents* web_contents_; | |
39 | |
40 // The WakeLockContext instance that is connected to this instance. | |
41 device::mojom::WakeLockContextPtr wake_lock_context_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(WakeLockContextHost); | |
44 }; | |
45 | |
46 } // namespace content | |
47 | |
48 #endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_CONTEXT_HOST_H_ | |
OLD | NEW |