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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SingleWebsitePreferences.java

Issue 2110543004: Move JNI bindings for url_formatter from chrome to //components/url_formatter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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.net.Uri; 10 import android.net.Uri;
11 import android.os.Bundle; 11 import android.os.Bundle;
12 import android.preference.ListPreference; 12 import android.preference.ListPreference;
13 import android.preference.Preference; 13 import android.preference.Preference;
14 import android.preference.Preference.OnPreferenceChangeListener; 14 import android.preference.Preference.OnPreferenceChangeListener;
15 import android.preference.Preference.OnPreferenceClickListener; 15 import android.preference.Preference.OnPreferenceClickListener;
16 import android.preference.PreferenceFragment; 16 import android.preference.PreferenceFragment;
17 import android.preference.PreferenceScreen; 17 import android.preference.PreferenceScreen;
18 import android.support.v7.app.AlertDialog; 18 import android.support.v7.app.AlertDialog;
19 import android.text.format.Formatter; 19 import android.text.format.Formatter;
20 import android.widget.ListAdapter; 20 import android.widget.ListAdapter;
21 import android.widget.ListView; 21 import android.widget.ListView;
22 22
23 import org.chromium.base.VisibleForTesting; 23 import org.chromium.base.VisibleForTesting;
24 import org.chromium.chrome.R; 24 import org.chromium.chrome.R;
25 import org.chromium.chrome.browser.ContentSettingsType; 25 import org.chromium.chrome.browser.ContentSettingsType;
26 import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader; 26 import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader;
27 import org.chromium.chrome.browser.search_engines.TemplateUrlService; 27 import org.chromium.chrome.browser.search_engines.TemplateUrlService;
28 import org.chromium.chrome.browser.util.UrlUtilities; 28 import org.chromium.components.url_formatter.UrlFormatter;
29 import org.chromium.content_public.browser.WebContents; 29 import org.chromium.content_public.browser.WebContents;
30 30
31 import java.net.URI; 31 import java.net.URI;
32 import java.util.Arrays; 32 import java.util.Arrays;
33 import java.util.Collection; 33 import java.util.Collection;
34 import java.util.HashSet; 34 import java.util.HashSet;
35 import java.util.Set; 35 import java.util.Set;
36 36
37 /** 37 /**
38 * Shows the permissions and other settings for a particular website. 38 * Shows the permissions and other settings for a particular website.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 * 144 *
145 * @param url The URL to open the fragment with. This is a complete url incl uding scheme, 145 * @param url The URL to open the fragment with. This is a complete url incl uding scheme,
146 * domain, port, path, etc. 146 * domain, port, path, etc.
147 * @return The bundle to attach to the preferences intent. 147 * @return The bundle to attach to the preferences intent.
148 */ 148 */
149 public static Bundle createFragmentArgsForSite(String url) { 149 public static Bundle createFragmentArgsForSite(String url) {
150 Bundle fragmentArgs = new Bundle(); 150 Bundle fragmentArgs = new Bundle();
151 // TODO(mvanouwerkerk): Define a pure getOrigin method in UrlUtilities t hat is the 151 // TODO(mvanouwerkerk): Define a pure getOrigin method in UrlUtilities t hat is the
152 // equivalent of the call below, because this is perfectly fine for non- display purposes. 152 // equivalent of the call below, because this is perfectly fine for non- display purposes.
153 String origin = 153 String origin =
154 UrlUtilities.formatUrlForSecurityDisplay(URI.create(url), true / * showScheme */); 154 UrlFormatter.formatUrlForSecurityDisplay(URI.create(url), true / * showScheme */);
155 fragmentArgs.putString(SingleWebsitePreferences.EXTRA_ORIGIN, origin); 155 fragmentArgs.putString(SingleWebsitePreferences.EXTRA_ORIGIN, origin);
156 return fragmentArgs; 156 return fragmentArgs;
157 } 157 }
158 158
159 @Override 159 @Override
160 public void onActivityCreated(Bundle savedInstanceState) { 160 public void onActivityCreated(Bundle savedInstanceState) {
161 getActivity().setTitle(R.string.prefs_site_settings); 161 getActivity().setTitle(R.string.prefs_site_settings);
162 ListView listView = (ListView) getView().findViewById(android.R.id.list) ; 162 ListView listView = (ListView) getView().findViewById(android.R.id.list) ;
163 listView.setDivider(null); 163 listView.setDivider(null);
164 164
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 if (mSite.getTotalUsage() > 0) { 702 if (mSite.getTotalUsage() > 0) {
703 clearStoredData(); 703 clearStoredData();
704 } else { 704 } else {
705 // Clearing stored data implies popping back to parent menu if there 705 // Clearing stored data implies popping back to parent menu if there
706 // is nothing left to show. Therefore, we only need to explicitly 706 // is nothing left to show. Therefore, we only need to explicitly
707 // close the activity if there's no stored data to begin with. 707 // close the activity if there's no stored data to begin with.
708 getActivity().finish(); 708 getActivity().finish();
709 } 709 }
710 } 710 }
711 } 711 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698