Reland the ULONG -> SIZE_T change from 317177
[chromium-blink-merge.git] / extensions / browser / api / serial / serial_service_factory.cc
blob31cac07f28dfc88290bf2d51a5d07425584ec6ec
1 // Copyright 2015 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.
5 #include "extensions/browser/api/serial/serial_service_factory.h"
7 #include "content/public/browser/browser_thread.h"
8 #include "device/serial/serial_service_impl.h"
10 namespace extensions {
11 namespace {
12 const base::Callback<void(
13 mojo::InterfaceRequest<device::serial::SerialService>)>*
14 g_serial_service_test_factory = nullptr;
17 void BindToSerialServiceRequest(
18 mojo::InterfaceRequest<device::serial::SerialService> request) {
19 if (g_serial_service_test_factory) {
20 g_serial_service_test_factory->Run(request.Pass());
21 return;
23 device::SerialServiceImpl::CreateOnMessageLoop(
24 content::BrowserThread::GetMessageLoopProxyForThread(
25 content::BrowserThread::FILE),
26 content::BrowserThread::GetMessageLoopProxyForThread(
27 content::BrowserThread::IO),
28 content::BrowserThread::GetMessageLoopProxyForThread(
29 content::BrowserThread::UI),
30 request.Pass());
33 void SetSerialServiceFactoryForTest(const base::Callback<
34 void(mojo::InterfaceRequest<device::serial::SerialService>)>* callback) {
35 g_serial_service_test_factory = callback;
38 } // namespace extensions