| 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/scoped_web_callbacks.h" | 12 #include "content/child/scoped_web_callbacks.h" |
| 13 #include "content/renderer/usb/type_converters.h" | 13 #include "content/renderer/usb/type_converters.h" |
| 14 #include "content/renderer/usb/web_usb_device_impl.h" | 14 #include "content/renderer/usb/web_usb_device_impl.h" |
| 15 #include "device/devices_app/public/cpp/constants.h" | 15 #include "device/devices_app/public/cpp/constants.h" |
| 16 #include "mojo/application/public/cpp/connect.h" | 16 #include "mojo/application/public/cpp/connect.h" |
| 17 #include "mojo/application/public/interfaces/shell.mojom.h" | 17 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 18 #include "third_party/WebKit/public/platform/WebCallbacks.h" | 18 #include "third_party/WebKit/public/platform/WebCallbacks.h" |
| 19 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" | 19 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" |
| 20 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h
" | 20 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h
" |
| 21 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" | 21 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceInfo.h" |
| 22 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceRequestO
ptions.h" | 22 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceRequestO
ptions.h" |
| 23 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" | 23 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBError.h" |
| 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" |
| 25 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
| 25 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 26 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 const char kNoServiceError[] = "USB service unavailable."; | 32 const char kNoServiceError[] = "USB service unavailable."; |
| 32 | 33 |
| 33 // Generic default rejection handler for any WebUSB callbacks type. Assumes | 34 // Generic default rejection handler for any WebUSB callbacks type. Assumes |
| 34 // |CallbacksType| is a blink::WebCallbacks<T, const blink::WebUSBError&> | 35 // |CallbacksType| is a blink::WebCallbacks<T, const blink::WebUSBError&> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 93 |
| 93 void WebUSBClientImpl::requestDevice( | 94 void WebUSBClientImpl::requestDevice( |
| 94 const blink::WebUSBDeviceRequestOptions& options, | 95 const blink::WebUSBDeviceRequestOptions& options, |
| 95 blink::WebUSBClientRequestDeviceCallbacks* callbacks) { | 96 blink::WebUSBClientRequestDeviceCallbacks* callbacks) { |
| 96 callbacks->onError(blink::WebUSBError(blink::WebUSBError::Error::Service, | 97 callbacks->onError(blink::WebUSBError(blink::WebUSBError::Error::Service, |
| 97 base::UTF8ToUTF16("Not implemented."))); | 98 base::UTF8ToUTF16("Not implemented."))); |
| 98 delete callbacks; | 99 delete callbacks; |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace content | 102 } // namespace content |
| OLD | NEW |