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

Unified Diff: chrome/browser/ui/android/bluetooth_chooser_android.cc

Issue 1771353004: Use FormatUrlForSecurityDisplay at BluetoothChooserAndroid constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use GetLastCommittedURL Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/android/bluetooth_chooser_android.cc
diff --git a/chrome/browser/ui/android/bluetooth_chooser_android.cc b/chrome/browser/ui/android/bluetooth_chooser_android.cc
index 5631e6428dd5f61655a75cd3d2bc0b0625f92e41..a24ef89fe9daa0832d1234d220946286ddad3562 100644
--- a/chrome/browser/ui/android/bluetooth_chooser_android.cc
+++ b/chrome/browser/ui/android/bluetooth_chooser_android.cc
@@ -7,13 +7,18 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/chrome_security_state_model_client.h"
#include "chrome/browser/ui/android/view_android_helper.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/prefs/pref_service.h"
+#include "components/url_formatter/elide_url.h"
#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/render_frame_host.h"
#include "jni/BluetoothChooserDialog_jni.h"
#include "ui/android/window_android.h"
+#include "url/gurl.h"
#include "url/origin.h"
using base::android::AttachCurrentThread;
@@ -40,8 +45,14 @@ BluetoothChooserAndroid::BluetoothChooserAndroid(
// Create (and show) the BluetoothChooser dialog.
JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jstring> origin_string =
- ConvertUTF8ToJavaString(env, origin.Serialize());
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+ std::string languages =
+ profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ base::android::ScopedJavaLocalRef<jstring> origin_string =
+ base::android::ConvertUTF16ToJavaString(
+ env, url_formatter::FormatUrlForSecurityDisplay(
+ frame->GetLastCommittedURL(), languages));
java_dialog_.Reset(Java_BluetoothChooserDialog_create(
env, window_android.obj(), origin_string.obj(),
security_model_client->GetSecurityInfo().security_level,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698