Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: content/browser/wake_lock/wake_lock_context_host.h

Issue 2734943003: Device Service: Decouple Wake Lock from //content (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 explicit WakeLockContextHost(WebContents* web_contents);
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_
OLDNEW
« no previous file with comments | « content/browser/wake_lock/wake_lock_browsertest.cc ('k') | content/browser/wake_lock/wake_lock_context_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698