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

Side by Side Diff: chrome/browser/ui/android/bluetooth_chooser_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 | « no previous file | chrome/browser/ui/android/usb_chooser_dialog_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bluetooth_chooser_android.h" 5 #include "chrome/browser/ui/android/bluetooth_chooser_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ssl/chrome_security_state_model_client.h" 10 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
(...skipping 25 matching lines...) Expand all
36 ->GetJavaObject(); 36 ->GetJavaObject();
37 37
38 ChromeSecurityStateModelClient* security_model_client = 38 ChromeSecurityStateModelClient* security_model_client =
39 ChromeSecurityStateModelClient::FromWebContents(web_contents_); 39 ChromeSecurityStateModelClient::FromWebContents(web_contents_);
40 DCHECK(security_model_client); 40 DCHECK(security_model_client);
41 41
42 // Create (and show) the BluetoothChooser dialog. 42 // Create (and show) the BluetoothChooser dialog.
43 JNIEnv* env = AttachCurrentThread(); 43 JNIEnv* env = AttachCurrentThread();
44 base::android::ScopedJavaLocalRef<jstring> origin_string = 44 base::android::ScopedJavaLocalRef<jstring> origin_string =
45 base::android::ConvertUTF16ToJavaString( 45 base::android::ConvertUTF16ToJavaString(
46 env, url_formatter::FormatUrlForSecurityDisplay( 46 env,
47 frame->GetLastCommittedURL())); 47 url_formatter::FormatUrlForSecurityDisplay(GURL(origin.Serialize())));
48 java_dialog_.Reset(Java_BluetoothChooserDialog_create( 48 java_dialog_.Reset(Java_BluetoothChooserDialog_create(
49 env, window_android.obj(), origin_string.obj(), 49 env, window_android.obj(), origin_string.obj(),
50 security_model_client->GetSecurityInfo().security_level, 50 security_model_client->GetSecurityInfo().security_level,
51 reinterpret_cast<intptr_t>(this))); 51 reinterpret_cast<intptr_t>(this)));
52 } 52 }
53 53
54 BluetoothChooserAndroid::~BluetoothChooserAndroid() { 54 BluetoothChooserAndroid::~BluetoothChooserAndroid() {
55 if (!java_dialog_.is_null()) { 55 if (!java_dialog_.is_null()) {
56 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(), 56 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(),
57 java_dialog_.obj()); 57 java_dialog_.obj());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // static 166 // static
167 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 167 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
168 return RegisterNativesImpl(env); 168 return RegisterNativesImpl(env);
169 } 169 }
170 170
171 void BluetoothChooserAndroid::OpenURL(const char* url) { 171 void BluetoothChooserAndroid::OpenURL(const char* url) {
172 web_contents_->OpenURL(content::OpenURLParams( 172 web_contents_->OpenURL(content::OpenURLParams(
173 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, 173 GURL(url), content::Referrer(), NEW_FOREGROUND_TAB,
174 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); 174 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */));
175 } 175 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/android/usb_chooser_dialog_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698