| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/usb/web_usb_client_impl.h" | 5 #include "content/renderer/usb/web_usb_client_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/move.h" | 10 #include "base/move.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/child/mojo/type_converters.h" | 12 #include "content/child/mojo/type_converters.h" |
| 13 #include "content/child/scoped_web_callbacks.h" | 13 #include "content/child/scoped_web_callbacks.h" |
| 14 #include "content/public/common/service_registry.h" | 14 #include "content/public/common/service_registry.h" |
| 15 #include "content/renderer/usb/type_converters.h" | 15 #include "content/renderer/usb/type_converters.h" |
| 16 #include "content/renderer/usb/web_usb_device_impl.h" | 16 #include "content/renderer/usb/web_usb_device_impl.h" |
| 17 #include "mojo/public/cpp/bindings/array.h" |
| 18 #include "mojo/public/cpp/bindings/interface_request.h" |
| 17 #include "third_party/WebKit/public/platform/WebCallbacks.h" | 19 #include "third_party/WebKit/public/platform/WebCallbacks.h" |
| 18 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" | 20 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" |
| 19 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h
" | 21 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h
" |
| 20 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" | 22 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" |
| 21 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceRequestO
ptions.h" | 23 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceRequestO
ptions.h" |
| 22 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" | 24 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" |
| 23 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | |
| 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const char kNoServiceError[] = "USB service unavailable."; | 30 const char kNoServiceError[] = "USB service unavailable."; |
| 31 | 31 |
| 32 // Generic default rejection handler for any WebUSB callbacks type. Assumes | 32 // Generic default rejection handler for any WebUSB callbacks type. Assumes |
| 33 // |CallbacksType| is a blink::WebCallbacks<T, const blink::WebUSBError&> | 33 // |CallbacksType| is a blink::WebCallbacks<T, const blink::WebUSBError&> |
| 34 // for any type |T|. | 34 // for any type |T|. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const device::usb::DeviceInfoPtr& device_info = | 156 const device::usb::DeviceInfoPtr& device_info = |
| 157 notification->devices_removed[i]; | 157 notification->devices_removed[i]; |
| 158 device::usb::DevicePtr device; | 158 device::usb::DevicePtr device; |
| 159 device_manager_->GetDevice(device_info->guid, mojo::GetProxy(&device)); | 159 device_manager_->GetDevice(device_info->guid, mojo::GetProxy(&device)); |
| 160 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl( | 160 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl( |
| 161 device.Pass(), mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info)))); | 161 device.Pass(), mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info)))); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace content | 165 } // namespace content |
| OLD | NEW |