OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/usb/usb_api.h" | 5 #include "chrome/browser/extensions/api/usb/usb_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static const char kErrorOverflow[] = "Inbound transfer overflow."; | 58 static const char kErrorOverflow[] = "Inbound transfer overflow."; |
59 static const char kErrorStalled[] = "Transfer stalled."; | 59 static const char kErrorStalled[] = "Transfer stalled."; |
60 static const char kErrorTimeout[] = "Transfer timed out."; | 60 static const char kErrorTimeout[] = "Transfer timed out."; |
61 static const char kErrorTransferLength[] = "Transfer length is insufficient."; | 61 static const char kErrorTransferLength[] = "Transfer length is insufficient."; |
62 | 62 |
63 static const char kErrorCannotListInterfaces[] = "Error listing interfaces."; | 63 static const char kErrorCannotListInterfaces[] = "Error listing interfaces."; |
64 static const char kErrorCannotClaimInterface[] = "Error claiming interface."; | 64 static const char kErrorCannotClaimInterface[] = "Error claiming interface."; |
65 static const char kErrorCannotReleaseInterface[] = "Error releasing interface."; | 65 static const char kErrorCannotReleaseInterface[] = "Error releasing interface."; |
66 static const char kErrorCannotSetInterfaceAlternateSetting[] = | 66 static const char kErrorCannotSetInterfaceAlternateSetting[] = |
67 "Error setting alternate interface setting."; | 67 "Error setting alternate interface setting."; |
68 static const char kErrorConvertDirection[] = "Invalid transfer direction."; | 68 static const char kErrorConvertDirection[] = "Invalid transsfer direction."; |
69 static const char kErrorConvertRecipient[] = "Invalid transfer recipient."; | 69 static const char kErrorConvertRecipient[] = "Invalid transfer recipient."; |
70 static const char kErrorConvertRequestType[] = "Invalid request type."; | 70 static const char kErrorConvertRequestType[] = "Invalid request type."; |
71 static const char kErrorConvertSynchronizationType[] = | 71 static const char kErrorConvertSynchronizationType[] = |
72 "Invalid synchronization type"; | 72 "Invalid synchronization type"; |
73 static const char kErrorConvertTransferType[] = "Invalid endpoint type."; | 73 static const char kErrorConvertTransferType[] = "Invalid endpoint type."; |
74 static const char kErrorConvertUsageType[] = "Invalid usage type."; | 74 static const char kErrorConvertUsageType[] = "Invalid usage type."; |
75 static const char kErrorMalformedParameters[] = "Error parsing parameters."; | 75 static const char kErrorMalformedParameters[] = "Error parsing parameters."; |
76 static const char kErrorNoDevice[] = "No such device."; | 76 static const char kErrorNoDevice[] = "No such device."; |
77 static const char kErrorPermissionDenied[] = | 77 static const char kErrorPermissionDenied[] = |
78 "Permission to access device was denied"; | 78 "Permission to access device was denied"; |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 // Close the device now because the handle is invalid after an | 1034 // Close the device now because the handle is invalid after an |
1035 // unsuccessful reset. | 1035 // unsuccessful reset. |
1036 BrowserThread::PostTaskAndReply( | 1036 BrowserThread::PostTaskAndReply( |
1037 BrowserThread::FILE, | 1037 BrowserThread::FILE, |
1038 FROM_HERE, | 1038 FROM_HERE, |
1039 base::Bind(&UsbDeviceHandle::Close, | 1039 base::Bind(&UsbDeviceHandle::Close, |
1040 resource->device()), | 1040 resource->device()), |
1041 base::Bind(&UsbResetDeviceFunction::OnError, this)); | 1041 base::Bind(&UsbResetDeviceFunction::OnError, this)); |
1042 return; | 1042 return; |
1043 } | 1043 } |
1044 SetResult(Value::CreateBooleanValue(true)); | 1044 SetResult(new base::FundamentalValue(true)); |
1045 AsyncWorkCompleted(); | 1045 AsyncWorkCompleted(); |
1046 } | 1046 } |
1047 | 1047 |
1048 void UsbResetDeviceFunction::OnError() { | 1048 void UsbResetDeviceFunction::OnError() { |
1049 RemoveUsbDeviceResource(parameters_->device.handle); | 1049 RemoveUsbDeviceResource(parameters_->device.handle); |
1050 SetError(kErrorResetDevice); | 1050 SetError(kErrorResetDevice); |
1051 SetResult(Value::CreateBooleanValue(false)); | 1051 SetResult(new base::FundamentalValue(false)); |
1052 AsyncWorkCompleted(); | 1052 AsyncWorkCompleted(); |
1053 } | 1053 } |
1054 | 1054 |
1055 } // namespace extensions | 1055 } // namespace extensions |
OLD | NEW |