Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: extensions/browser/api/usb/usb_api.cc

Issue 510313002: Extensions-related fixups for scoped_refptr conversion operator removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_apitest.cc ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698