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

Side by Side Diff: device/usb/usb_device_filter.cc

Issue 2266153002: Modify UsbDeviceFilter::MatchesAny to return true for empty filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed code for unit test Created 4 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
« no previous file with comments | « device/usb/mojo/device_manager_impl.cc ('k') | device/usb/usb_device_filter_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 "device/usb/usb_device_filter.h" 5 #include "device/usb/usb_device_filter.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 return std::move(obj); 114 return std::move(obj);
115 } 115 }
116 116
117 // static 117 // static
118 bool UsbDeviceFilter::MatchesAny(scoped_refptr<UsbDevice> device, 118 bool UsbDeviceFilter::MatchesAny(scoped_refptr<UsbDevice> device,
119 const std::vector<UsbDeviceFilter>& filters) { 119 const std::vector<UsbDeviceFilter>& filters) {
120 if (filters.empty())
121 return true;
122
120 for (std::vector<UsbDeviceFilter>::const_iterator i = filters.begin(); 123 for (std::vector<UsbDeviceFilter>::const_iterator i = filters.begin();
121 i != filters.end(); 124 i != filters.end();
122 ++i) { 125 ++i) {
123 if (i->Matches(device)) { 126 if (i->Matches(device)) {
124 return true; 127 return true;
125 } 128 }
126 } 129 }
127 return false; 130 return false;
128 } 131 }
129 132
130 } // namespace device 133 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/mojo/device_manager_impl.cc ('k') | device/usb/usb_device_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698