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

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

Issue 1996603003: Display origin for WebBluetooth and WebUSB chooser on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display origin for WebBluetooth and WebUSB chooser on Android Created 4 years, 7 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/browser/ui/android/bluetooth_chooser_android.cc ('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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Create (and show) the UsbChooser dialog. 53 // Create (and show) the UsbChooser dialog.
54 content::WebContents* web_contents = 54 content::WebContents* web_contents =
55 content::WebContents::FromRenderFrameHost(render_frame_host_); 55 content::WebContents::FromRenderFrameHost(render_frame_host_);
56 base::android::ScopedJavaLocalRef<jobject> window_android = 56 base::android::ScopedJavaLocalRef<jobject> window_android =
57 content::ContentViewCore::FromWebContents(web_contents) 57 content::ContentViewCore::FromWebContents(web_contents)
58 ->GetWindowAndroid() 58 ->GetWindowAndroid()
59 ->GetJavaObject(); 59 ->GetJavaObject();
60 JNIEnv* env = base::android::AttachCurrentThread(); 60 JNIEnv* env = base::android::AttachCurrentThread();
61 base::android::ScopedJavaLocalRef<jstring> origin_string = 61 base::android::ScopedJavaLocalRef<jstring> origin_string =
62 base::android::ConvertUTF16ToJavaString( 62 base::android::ConvertUTF16ToJavaString(
63 env, url_formatter::FormatUrlForSecurityDisplay( 63 env, url_formatter::FormatUrlForSecurityDisplay(GURL(
64 render_frame_host->GetLastCommittedURL())); 64 render_frame_host->GetLastCommittedOrigin().Serialize())));
65 ChromeSecurityStateModelClient* security_model_client = 65 ChromeSecurityStateModelClient* security_model_client =
66 ChromeSecurityStateModelClient::FromWebContents(web_contents); 66 ChromeSecurityStateModelClient::FromWebContents(web_contents);
67 DCHECK(security_model_client); 67 DCHECK(security_model_client);
68 java_dialog_.Reset(Java_UsbChooserDialog_create( 68 java_dialog_.Reset(Java_UsbChooserDialog_create(
69 env, window_android.obj(), origin_string.obj(), 69 env, window_android.obj(), origin_string.obj(),
70 security_model_client->GetSecurityInfo().security_level, 70 security_model_client->GetSecurityInfo().security_level,
71 reinterpret_cast<intptr_t>(this))); 71 reinterpret_cast<intptr_t>(this)));
72 72
73 if (!java_dialog_.is_null()) { 73 if (!java_dialog_.is_null()) {
74 usb_service->GetDevices( 74 usb_service->GetDevices(
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(), 214 ->OpenURL(content::OpenURLParams(GURL(url), content::Referrer(),
215 NEW_FOREGROUND_TAB, 215 NEW_FOREGROUND_TAB,
216 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 216 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
217 false)); // is_renderer_initiated 217 false)); // is_renderer_initiated
218 } 218 }
219 219
220 // static 220 // static
221 bool UsbChooserDialogAndroid::Register(JNIEnv* env) { 221 bool UsbChooserDialogAndroid::Register(JNIEnv* env) {
222 return RegisterNativesImpl(env); 222 return RegisterNativesImpl(env);
223 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698