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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappUrlBar.java

Issue 1357563002: Expose FormatUrlForSecurityDisplay to Java on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using a fake scheme in the test makes formatUrlForSecurityDisplay be conservative, breaking the tes… Created 5 years, 3 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
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 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.drawable.Drawable; 8 import android.graphics.drawable.Drawable;
9 import android.text.Layout; 9 import android.text.Layout;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mU rlBar, 157 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mU rlBar,
158 mCurrentIconResource, 0, 0, 0); 158 mCurrentIconResource, 0, 0, 0);
159 } 159 }
160 160
161 private void updateDisplayedUrl(String originalUrl, URI uri) { 161 private void updateDisplayedUrl(String originalUrl, URI uri) {
162 boolean showScheme = mCurrentIconResource == 0; 162 boolean showScheme = mCurrentIconResource == 0;
163 String displayUrl = originalUrl; 163 String displayUrl = originalUrl;
164 if (uri != null) { 164 if (uri != null) {
165 String shortenedUrl = UrlUtilities.getOriginForDisplay(uri, showSche me); 165 String shortenedUrl = UrlUtilities.formatUrlForSecurityDisplay(uri, showScheme);
166 if (!TextUtils.isEmpty(shortenedUrl)) displayUrl = shortenedUrl; 166 if (!TextUtils.isEmpty(shortenedUrl)) displayUrl = shortenedUrl;
167 } 167 }
168 168
169 mUrlBar.setText(displayUrl); 169 mUrlBar.setText(displayUrl);
170 if (!TextUtils.equals(mCurrentlyDisplayedUrl, displayUrl)) { 170 if (!TextUtils.equals(mCurrentlyDisplayedUrl, displayUrl)) {
171 mCurrentlyDisplayedUrl = displayUrl; 171 mCurrentlyDisplayedUrl = displayUrl;
172 } 172 }
173 } 173 }
174 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698