OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 ->GetJavaObject(); | 37 ->GetJavaObject(); |
38 | 38 |
39 ChromeSecurityStateModelClient* security_model_client = | 39 ChromeSecurityStateModelClient* security_model_client = |
40 ChromeSecurityStateModelClient::FromWebContents(web_contents_); | 40 ChromeSecurityStateModelClient::FromWebContents(web_contents_); |
41 DCHECK(security_model_client); | 41 DCHECK(security_model_client); |
42 | 42 |
43 // Create (and show) the BluetoothChooser dialog. | 43 // Create (and show) the BluetoothChooser dialog. |
44 JNIEnv* env = AttachCurrentThread(); | 44 JNIEnv* env = AttachCurrentThread(); |
45 base::android::ScopedJavaLocalRef<jstring> origin_string = | 45 base::android::ScopedJavaLocalRef<jstring> origin_string = |
46 base::android::ConvertUTF16ToJavaString( | 46 base::android::ConvertUTF16ToJavaString( |
47 env, | 47 env, url_formatter::FormatUrlForSecurityDisplay(origin.GetURL())); |
48 url_formatter::FormatUrlForSecurityDisplay(GURL(origin.Serialize()))); | |
49 security_state::SecurityStateModel::SecurityInfo security_info; | 48 security_state::SecurityStateModel::SecurityInfo security_info; |
50 security_model_client->GetSecurityInfo(&security_info); | 49 security_model_client->GetSecurityInfo(&security_info); |
51 java_dialog_.Reset(Java_BluetoothChooserDialog_create( | 50 java_dialog_.Reset(Java_BluetoothChooserDialog_create( |
52 env, window_android, origin_string, security_info.security_level, | 51 env, window_android, origin_string, security_info.security_level, |
53 reinterpret_cast<intptr_t>(this))); | 52 reinterpret_cast<intptr_t>(this))); |
54 } | 53 } |
55 | 54 |
56 BluetoothChooserAndroid::~BluetoothChooserAndroid() { | 55 BluetoothChooserAndroid::~BluetoothChooserAndroid() { |
57 if (!java_dialog_.is_null()) { | 56 if (!java_dialog_.is_null()) { |
58 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(), | 57 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(), |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // static | 170 // static |
172 bool BluetoothChooserAndroid::Register(JNIEnv* env) { | 171 bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
173 return RegisterNativesImpl(env); | 172 return RegisterNativesImpl(env); |
174 } | 173 } |
175 | 174 |
176 void BluetoothChooserAndroid::OpenURL(const char* url) { | 175 void BluetoothChooserAndroid::OpenURL(const char* url) { |
177 web_contents_->OpenURL(content::OpenURLParams( | 176 web_contents_->OpenURL(content::OpenURLParams( |
178 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, | 177 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
179 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); | 178 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
180 } | 179 } |
OLD | NEW |