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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.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.preferences.website; 5 package org.chromium.chrome.browser.preferences.website;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.DialogInterface; 8 import android.content.DialogInterface;
9 import android.content.res.Resources; 9 import android.content.res.Resources;
10 import android.graphics.PorterDuff; 10 import android.graphics.PorterDuff;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 * the website with the given url. 124 * the website with the given url.
125 * 125 *
126 * @param url The URL to open the fragment with. This is a complete url incl uding scheme, 126 * @param url The URL to open the fragment with. This is a complete url incl uding scheme,
127 * domain, port, path, etc. 127 * domain, port, path, etc.
128 * @return The bundle to attach to the preferences intent. 128 * @return The bundle to attach to the preferences intent.
129 */ 129 */
130 public static Bundle createFragmentArgsForSite(String url) { 130 public static Bundle createFragmentArgsForSite(String url) {
131 Bundle fragmentArgs = new Bundle(); 131 Bundle fragmentArgs = new Bundle();
132 // TODO(mvanouwerkerk): Define a pure getOrigin method in UrlUtilities t hat is the 132 // TODO(mvanouwerkerk): Define a pure getOrigin method in UrlUtilities t hat is the
133 // equivalent of the call below, because this is perfectly fine for non- display purposes. 133 // equivalent of the call below, because this is perfectly fine for non- display purposes.
134 String origin = UrlUtilities.getOriginForDisplay(URI.create(url), true / * schowScheme */); 134 String origin =
135 UrlUtilities.formatUrlForSecurityDisplay(URI.create(url), true / * showScheme */);
135 fragmentArgs.putString(SingleWebsitePreferences.EXTRA_ORIGIN, origin); 136 fragmentArgs.putString(SingleWebsitePreferences.EXTRA_ORIGIN, origin);
136 return fragmentArgs; 137 return fragmentArgs;
137 } 138 }
138 139
139 @Override 140 @Override
140 public void onActivityCreated(Bundle savedInstanceState) { 141 public void onActivityCreated(Bundle savedInstanceState) {
141 getActivity().setTitle(R.string.prefs_site_settings); 142 getActivity().setTitle(R.string.prefs_site_settings);
142 ListView listView = (ListView) getView().findViewById(android.R.id.list) ; 143 ListView listView = (ListView) getView().findViewById(android.R.id.list) ;
143 listView.setDivider(null); 144 listView.setDivider(null);
144 145
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (mSite.getTotalUsage() > 0) { 626 if (mSite.getTotalUsage() > 0) {
626 clearStoredData(); 627 clearStoredData();
627 } else { 628 } else {
628 // Clearing stored data implies popping back to parent menu if there 629 // Clearing stored data implies popping back to parent menu if there
629 // is nothing left to show. Therefore, we only need to explicitly 630 // is nothing left to show. Therefore, we only need to explicitly
630 // close the activity if there's no stored data to begin with. 631 // close the activity if there's no stored data to begin with.
631 getActivity().finish(); 632 getActivity().finish();
632 } 633 }
633 } 634 }
634 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698