| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/usb/usb_api.h" | 5 #include "extensions/browser/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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 scoped_refptr<UsbDeviceHandle> | 457 scoped_refptr<UsbDeviceHandle> |
| 458 UsbAsyncApiFunction::GetDeviceHandleOrCompleteWithError( | 458 UsbAsyncApiFunction::GetDeviceHandleOrCompleteWithError( |
| 459 const ConnectionHandle& input_device_handle) { | 459 const ConnectionHandle& input_device_handle) { |
| 460 UsbDeviceResource* resource = | 460 UsbDeviceResource* resource = |
| 461 manager_->Get(extension_->id(), input_device_handle.handle); | 461 manager_->Get(extension_->id(), input_device_handle.handle); |
| 462 if (!resource) { | 462 if (!resource) { |
| 463 CompleteWithError(kErrorNoDevice); | 463 CompleteWithError(kErrorNoDevice); |
| 464 return NULL; | 464 return NULL; |
| 465 } | 465 } |
| 466 | 466 |
| 467 if (!resource->device() || !resource->device()->GetDevice()) { | 467 if (!resource->device().get() || !resource->device()->GetDevice().get()) { |
| 468 CompleteWithError(kErrorDisconnect); | 468 CompleteWithError(kErrorDisconnect); |
| 469 manager_->Remove(extension_->id(), input_device_handle.handle); | 469 manager_->Remove(extension_->id(), input_device_handle.handle); |
| 470 return NULL; | 470 return NULL; |
| 471 } | 471 } |
| 472 | 472 |
| 473 if (resource->device()->GetDevice()->vendor_id() != | 473 if (resource->device()->GetDevice()->vendor_id() != |
| 474 input_device_handle.vendor_id || | 474 input_device_handle.vendor_id || |
| 475 resource->device()->GetDevice()->product_id() != | 475 resource->device()->GetDevice()->product_id() != |
| 476 input_device_handle.product_id) { | 476 input_device_handle.product_id) { |
| 477 CompleteWithError(kErrorNoDevice); | 477 CompleteWithError(kErrorNoDevice); |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 SetResult(new base::FundamentalValue(false)); | 1199 SetResult(new base::FundamentalValue(false)); |
| 1200 CompleteWithError(kErrorResetDevice); | 1200 CompleteWithError(kErrorResetDevice); |
| 1201 return; | 1201 return; |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 SetResult(new base::FundamentalValue(true)); | 1204 SetResult(new base::FundamentalValue(true)); |
| 1205 AsyncWorkCompleted(); | 1205 AsyncWorkCompleted(); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 } // namespace extensions | 1208 } // namespace extensions |
| OLD | NEW |