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

Unified Diff: extensions/browser/api/serial/serial_service_factory.cc

Issue 919943002: Remove extensions::ServiceRegistrationManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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
Index: extensions/browser/api/serial/serial_service_factory.cc
diff --git a/extensions/browser/api/serial/serial_service_factory.cc b/extensions/browser/api/serial/serial_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..31cac07f28dfc88290bf2d51a5d07425584ec6ec
--- /dev/null
+++ b/extensions/browser/api/serial/serial_service_factory.cc
@@ -0,0 +1,38 @@
+// Copyright 2015 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 "extensions/browser/api/serial/serial_service_factory.h"
+
+#include "content/public/browser/browser_thread.h"
+#include "device/serial/serial_service_impl.h"
+
+namespace extensions {
+namespace {
+const base::Callback<void(
+ mojo::InterfaceRequest<device::serial::SerialService>)>*
+ g_serial_service_test_factory = nullptr;
+}
+
+void BindToSerialServiceRequest(
+ mojo::InterfaceRequest<device::serial::SerialService> request) {
+ if (g_serial_service_test_factory) {
+ g_serial_service_test_factory->Run(request.Pass());
+ return;
+ }
+ device::SerialServiceImpl::CreateOnMessageLoop(
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::FILE),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI),
+ request.Pass());
+}
+
+void SetSerialServiceFactoryForTest(const base::Callback<
+ void(mojo::InterfaceRequest<device::serial::SerialService>)>* callback) {
+ g_serial_service_test_factory = callback;
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/browser/api/serial/serial_service_factory.h ('k') | extensions/browser/extension_web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698