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

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

Issue 2426573005: bluetooth-chooser: Refactor and clean up bluetooth chooser (Closed)
Patch Set: Address tedchoc's comments Created 4 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 | « chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::android::ScopedJavaLocalRef<jstring> device_name = 204 base::android::ScopedJavaLocalRef<jstring> device_name =
205 base::android::ConvertUTF16ToJavaString(env, device->product_string()); 205 base::android::ConvertUTF16ToJavaString(env, device->product_string());
206 Java_UsbChooserDialog_addDevice(env, java_dialog_, device_guid, device_name); 206 Java_UsbChooserDialog_addDevice(env, java_dialog_, device_guid, device_name);
207 } 207 }
208 208
209 void UsbChooserDialogAndroid::RemoveDeviceFromChooserDialog( 209 void UsbChooserDialogAndroid::RemoveDeviceFromChooserDialog(
210 scoped_refptr<UsbDevice> device) const { 210 scoped_refptr<UsbDevice> device) const {
211 JNIEnv* env = base::android::AttachCurrentThread(); 211 JNIEnv* env = base::android::AttachCurrentThread();
212 base::android::ScopedJavaLocalRef<jstring> device_guid = 212 base::android::ScopedJavaLocalRef<jstring> device_guid =
213 base::android::ConvertUTF8ToJavaString(env, device->guid()); 213 base::android::ConvertUTF8ToJavaString(env, device->guid());
214 base::android::ScopedJavaLocalRef<jstring> device_name = 214 Java_UsbChooserDialog_removeDevice(env, java_dialog_, device_guid);
215 base::android::ConvertUTF16ToJavaString(env, device->product_string());
216 Java_UsbChooserDialog_removeDevice(env, java_dialog_, device_guid,
217 device_name);
218 } 215 }
219 216
220 void UsbChooserDialogAndroid::OpenUrl(const std::string& url) { 217 void UsbChooserDialogAndroid::OpenUrl(const std::string& url) {
221 content::WebContents::FromRenderFrameHost(render_frame_host_) 218 content::WebContents::FromRenderFrameHost(render_frame_host_)
222 ->OpenURL( 219 ->OpenURL(
223 content::OpenURLParams(GURL(url), content::Referrer(), 220 content::OpenURLParams(GURL(url), content::Referrer(),
224 WindowOpenDisposition::NEW_FOREGROUND_TAB, 221 WindowOpenDisposition::NEW_FOREGROUND_TAB,
225 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 222 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
226 false)); // is_renderer_initiated 223 false)); // is_renderer_initiated
227 } 224 }
(...skipping 11 matching lines...) Expand all
239 236
240 return device::FindInWebUsbAllowedOrigins( 237 return device::FindInWebUsbAllowedOrigins(
241 device->webusb_allowed_origins(), 238 device->webusb_allowed_origins(),
242 render_frame_host_->GetLastCommittedURL().GetOrigin()); 239 render_frame_host_->GetLastCommittedURL().GetOrigin());
243 } 240 }
244 241
245 // static 242 // static
246 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { 243 bool UsbChooserDialogAndroid::Register(JNIEnv* env) {
247 return RegisterNativesImpl(env); 244 return RegisterNativesImpl(env);
248 } 245 }
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698