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

Unified Diff: device/wake_lock/wake_lock_context_provider.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/wake_lock/wake_lock_context_provider.h ('k') | device/wake_lock/wake_lock_service_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/wake_lock/wake_lock_context_provider.cc
diff --git a/device/wake_lock/wake_lock_context_provider.cc b/device/wake_lock/wake_lock_context_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..289b1c64296e0a9fa16fcad911aed53623cae367
--- /dev/null
+++ b/device/wake_lock/wake_lock_context_provider.cc
@@ -0,0 +1,40 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/wake_lock/wake_lock_context_provider.h"
+
+#include <utility>
+
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace device {
+
+// static
+void WakeLockContextProvider::Create(
+ mojom::WakeLockContextProviderRequest request,
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
+ const WakeLockContextCallback& native_view_getter) {
+ mojo::MakeStrongBinding(base::MakeUnique<WakeLockContextProvider>(
+ std::move(file_task_runner), native_view_getter),
+ std::move(request));
+}
+
+WakeLockContextProvider::WakeLockContextProvider(
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
+ const WakeLockContextCallback& native_view_getter)
+ : file_task_runner_(std::move(file_task_runner)),
+ native_view_getter_(native_view_getter) {}
+
+WakeLockContextProvider::~WakeLockContextProvider() {}
+
+void WakeLockContextProvider::GetContext(
+ int context_id,
+ mojo::InterfaceRequest<mojom::WakeLockContext> request) {
+ // WakeLockServiceContext owns itself (see the comment on
+ // wake_lock_service_context.h).
+ new WakeLockServiceContext(std::move(request), context_id, file_task_runner_,
+ native_view_getter_);
+}
+
+} // namespace device
« no previous file with comments | « device/wake_lock/wake_lock_context_provider.h ('k') | device/wake_lock/wake_lock_service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698