| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 device::usb::DeviceInfo::From(*devices_[i]); | 131 device::usb::DeviceInfo::From(*devices_[i]); |
| 132 callback_.Run(std::move(device_info_ptr)); | 132 callback_.Run(std::move(device_info_ptr)); |
| 133 callback_.reset(); // Reset |callback_| so that it is only run once. | 133 callback_.reset(); // Reset |callback_| so that it is only run once. |
| 134 Java_UsbChooserDialog_closeDialog(base::android::AttachCurrentThread(), | 134 Java_UsbChooserDialog_closeDialog(base::android::AttachCurrentThread(), |
| 135 java_dialog_.obj()); | 135 java_dialog_.obj()); |
| 136 | 136 |
| 137 RecordWebUsbChooserClosure( | 137 RecordWebUsbChooserClosure( |
| 138 devices_[i]->serial_number().empty() | 138 devices_[i]->serial_number().empty() |
| 139 ? WEBUSB_CHOOSER_CLOSED_EPHEMERAL_PERMISSION_GRANTED | 139 ? WEBUSB_CHOOSER_CLOSED_EPHEMERAL_PERMISSION_GRANTED |
| 140 : WEBUSB_CHOOSER_CLOSED_PERMISSION_GRANTED); | 140 : WEBUSB_CHOOSER_CLOSED_PERMISSION_GRANTED); |
| 141 |
| 142 return; |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 } | 145 } |
| 144 | 146 |
| 145 void UsbChooserDialogAndroid::Cancel() { | 147 void UsbChooserDialogAndroid::Cancel() { |
| 146 callback_.Run(nullptr); | 148 callback_.Run(nullptr); |
| 147 callback_.reset(); // Reset |callback_| so that it is only run once. | 149 callback_.reset(); // Reset |callback_| so that it is only run once. |
| 148 Java_UsbChooserDialog_closeDialog(base::android::AttachCurrentThread(), | 150 Java_UsbChooserDialog_closeDialog(base::android::AttachCurrentThread(), |
| 149 java_dialog_.obj()); | 151 java_dialog_.obj()); |
| 150 | 152 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(), | 219 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(), |
| 218 NEW_FOREGROUND_TAB, | 220 NEW_FOREGROUND_TAB, |
| 219 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 221 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 220 false)); // is_renderer_initiated | 222 false)); // is_renderer_initiated |
| 221 } | 223 } |
| 222 | 224 |
| 223 // static | 225 // static |
| 224 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { | 226 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { |
| 225 return RegisterNativesImpl(env); | 227 return RegisterNativesImpl(env); |
| 226 } | 228 } |
| OLD | NEW |