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

Side by Side Diff: apps/saved_devices_service.cc

Issue 601073002: Move string descriptor getters from UsbDeviceHandle to UsbDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix function order. Created 6 years, 2 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
« no previous file with comments | « no previous file | apps/saved_devices_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "apps/saved_devices_service.h" 5 #include "apps/saved_devices_service.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/saved_devices_service_factory.h" 10 #include "apps/saved_devices_service_factory.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 persistent_devices_.begin(); 151 persistent_devices_.begin();
152 it != persistent_devices_.end(); 152 it != persistent_devices_.end();
153 ++it) { 153 ++it) {
154 if (it->vendor_id != device->vendor_id()) { 154 if (it->vendor_id != device->vendor_id()) {
155 continue; 155 continue;
156 } 156 }
157 if (it->product_id != device->product_id()) { 157 if (it->product_id != device->product_id()) {
158 continue; 158 continue;
159 } 159 }
160 if (!have_serial_number) { 160 if (!have_serial_number) {
161 scoped_refptr<UsbDeviceHandle> device_handle = device->Open(); 161 if (!device->GetSerialNumber(&serial_number)) {
162 if (!device_handle.get()) {
163 break;
164 }
165 if (!device_handle->GetSerial(&serial_number)) {
166 break; 162 break;
167 } 163 }
168 have_serial_number = true; 164 have_serial_number = true;
169 } 165 }
170 if (it->serial_number != serial_number) { 166 if (it->serial_number != serial_number) {
171 continue; 167 continue;
172 } 168 }
173 return true; 169 return true;
174 } 170 }
175 return false; 171 return false;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 std::map<std::string, SavedDevices*>::const_iterator it = 307 std::map<std::string, SavedDevices*>::const_iterator it =
312 extension_id_to_saved_devices_.find(extension_id); 308 extension_id_to_saved_devices_.find(extension_id);
313 if (it != extension_id_to_saved_devices_.end()) { 309 if (it != extension_id_to_saved_devices_.end()) {
314 return it->second; 310 return it->second;
315 } 311 }
316 312
317 return NULL; 313 return NULL;
318 } 314 }
319 315
320 } // namespace apps 316 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | apps/saved_devices_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698