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

Side by Side Diff: chrome/browser/ui/android/usb_chooser_dialog_android.cc

Issue 2727633004: Change UsbDeviceFilter to use const references instead of (Closed)
Patch Set: Fix callsite missed earlier due to not building for CrOS Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/android/usb_chooser_dialog_android.h" 5 #include "chrome/browser/ui/android/usb_chooser_dialog_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 content::WebContents::FromRenderFrameHost(render_frame_host_) 218 content::WebContents::FromRenderFrameHost(render_frame_host_)
219 ->OpenURL( 219 ->OpenURL(
220 content::OpenURLParams(GURL(url), content::Referrer(), 220 content::OpenURLParams(GURL(url), content::Referrer(),
221 WindowOpenDisposition::NEW_FOREGROUND_TAB, 221 WindowOpenDisposition::NEW_FOREGROUND_TAB,
222 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 222 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
223 false)); // is_renderer_initiated 223 false)); // is_renderer_initiated
224 } 224 }
225 225
226 bool UsbChooserDialogAndroid::DisplayDevice( 226 bool UsbChooserDialogAndroid::DisplayDevice(
227 scoped_refptr<UsbDevice> device) const { 227 scoped_refptr<UsbDevice> device) const {
228 if (!device::UsbDeviceFilter::MatchesAny(device, filters_)) 228 if (!device::UsbDeviceFilter::MatchesAny(*device, filters_))
229 return false; 229 return false;
230 230
231 // On Android it is not possible to read the WebUSB descriptors until Chrome 231 // On Android it is not possible to read the WebUSB descriptors until Chrome
232 // has been granted permission to open it. Instead we must list all devices 232 // has been granted permission to open it. Instead we must list all devices
233 // and perform the allowed origins check after the device has been selected. 233 // and perform the allowed origins check after the device has been selected.
234 if (!device->permission_granted()) 234 if (!device->permission_granted())
235 return true; 235 return true;
236 236
237 return device::FindInWebUsbAllowedOrigins( 237 return device::FindInWebUsbAllowedOrigins(
238 device->webusb_allowed_origins(), 238 device->webusb_allowed_origins(),
239 render_frame_host_->GetLastCommittedURL().GetOrigin(), base::nullopt, 239 render_frame_host_->GetLastCommittedURL().GetOrigin(), base::nullopt,
240 base::nullopt); 240 base::nullopt);
241 } 241 }
242 242
243 // static 243 // static
244 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { 244 bool UsbChooserDialogAndroid::Register(JNIEnv* env) {
245 return RegisterNativesImpl(env); 245 return RegisterNativesImpl(env);
246 } 246 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/printing/usb_printer_util.cc ('k') | chrome/browser/usb/usb_chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698