| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |