| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "extensions/browser/api/serial/serial_service_factory.h" |
| 6 |
| 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "device/serial/serial_service_impl.h" |
| 9 |
| 10 namespace extensions { |
| 11 namespace { |
| 12 const base::Callback<void( |
| 13 mojo::InterfaceRequest<device::serial::SerialService>)>* |
| 14 g_serial_service_test_factory = nullptr; |
| 15 } |
| 16 |
| 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; |
| 22 } |
| 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()); |
| 31 } |
| 32 |
| 33 void SetSerialServiceFactoryForTest(const base::Callback< |
| 34 void(mojo::InterfaceRequest<device::serial::SerialService>)>* callback) { |
| 35 g_serial_service_test_factory = callback; |
| 36 } |
| 37 |
| 38 } // namespace extensions |
| OLD | NEW |