| OLD | NEW |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void UsbChooserDialogAndroid::OnDialogCancelled( | 159 void UsbChooserDialogAndroid::OnDialogCancelled( |
| 160 JNIEnv* env, | 160 JNIEnv* env, |
| 161 const base::android::JavaParamRef<jobject>& obj) { | 161 const base::android::JavaParamRef<jobject>& obj) { |
| 162 Cancel(); | 162 Cancel(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void UsbChooserDialogAndroid::LoadUsbHelpPage( | 165 void UsbChooserDialogAndroid::LoadUsbHelpPage( |
| 166 JNIEnv* env, | 166 JNIEnv* env, |
| 167 const base::android::JavaParamRef<jobject>& obj) { | 167 const base::android::JavaParamRef<jobject>& obj) { |
| 168 OpenUrl(chrome::kChooserUsbOverviewURL); | 168 OpenUrl(chrome::kChooserUsbOverviewURL); |
| 169 Cancel(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 // Get a list of devices that can be shown in the chooser bubble UI for | 172 // Get a list of devices that can be shown in the chooser bubble UI for |
| 172 // user to grant permsssion. | 173 // user to grant permsssion. |
| 173 void UsbChooserDialogAndroid::GotUsbDeviceList( | 174 void UsbChooserDialogAndroid::GotUsbDeviceList( |
| 174 const std::vector<scoped_refptr<device::UsbDevice>>& devices) { | 175 const std::vector<scoped_refptr<device::UsbDevice>>& devices) { |
| 175 for (const auto& device : devices) { | 176 for (const auto& device : devices) { |
| 176 if (device::UsbDeviceFilter::MatchesAny(device, filters_) && | 177 if (device::UsbDeviceFilter::MatchesAny(device, filters_) && |
| 177 FindInWebUsbAllowedOrigins( | 178 FindInWebUsbAllowedOrigins( |
| 178 device->webusb_allowed_origins(), | 179 device->webusb_allowed_origins(), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(), | 214 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(), |
| 214 NEW_FOREGROUND_TAB, | 215 NEW_FOREGROUND_TAB, |
| 215 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 216 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 216 false)); // is_renderer_initiated | 217 false)); // is_renderer_initiated |
| 217 } | 218 } |
| 218 | 219 |
| 219 // static | 220 // static |
| 220 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { | 221 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { |
| 221 return RegisterNativesImpl(env); | 222 return RegisterNativesImpl(env); |
| 222 } | 223 } |
| OLD | NEW |