mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1249783 - Remove ability to disable suggested sites. r=margaret
MozReview-Commit-ID: 4BcJlWV0E9L --HG-- extra : transplant_source : %FD%17%87%E0%AAb%81YT%A3y%2C%13%EB5%91i%B7m%13
This commit is contained in:
parent
5e122b6f0a
commit
e3ac74f061
@ -41,7 +41,6 @@ import org.mozilla.gecko.Locales;
|
|||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.distribution.Distribution;
|
import org.mozilla.gecko.distribution.Distribution;
|
||||||
import org.mozilla.gecko.Restrictions;
|
import org.mozilla.gecko.Restrictions;
|
||||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
|
||||||
import org.mozilla.gecko.util.RawResource;
|
import org.mozilla.gecko.util.RawResource;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
|
|
||||||
@ -408,11 +407,6 @@ public class SuggestedSites {
|
|||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEnabled() {
|
|
||||||
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
|
|
||||||
return prefs.getBoolean(GeckoPreferences.PREFS_SUGGESTED_SITES, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized Site getSiteForUrl(String url) {
|
private synchronized Site getSiteForUrl(String url) {
|
||||||
if (cachedSites == null) {
|
if (cachedSites == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -459,13 +453,6 @@ public class SuggestedSites {
|
|||||||
*/
|
*/
|
||||||
public synchronized Cursor get(int limit, Locale locale, List<String> excludeUrls) {
|
public synchronized Cursor get(int limit, Locale locale, List<String> excludeUrls) {
|
||||||
final MatrixCursor cursor = new MatrixCursor(COLUMNS);
|
final MatrixCursor cursor = new MatrixCursor(COLUMNS);
|
||||||
|
|
||||||
// Return an empty cursor if suggested sites have been
|
|
||||||
// disabled by the user.
|
|
||||||
if (!isEnabled()) {
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isNewLocale = isNewLocale(context, locale);
|
final boolean isNewLocale = isNewLocale(context, locale);
|
||||||
|
|
||||||
// Force the suggested sites file in profile dir to be re-generated
|
// Force the suggested sites file in profile dir to be re-generated
|
||||||
|
@ -160,7 +160,6 @@ OnSharedPreferenceChangeListener
|
|||||||
private static final String PREFS_BROWSER_LOCALE = "locale";
|
private static final String PREFS_BROWSER_LOCALE = "locale";
|
||||||
|
|
||||||
public static final String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession3";
|
public static final String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession3";
|
||||||
public static final String PREFS_SUGGESTED_SITES = NON_PREF_PREFIX + "home_suggested_sites";
|
|
||||||
public static final String PREFS_TAB_QUEUE = NON_PREF_PREFIX + "tab_queue";
|
public static final String PREFS_TAB_QUEUE = NON_PREF_PREFIX + "tab_queue";
|
||||||
public static final String PREFS_TAB_QUEUE_LAST_SITE = NON_PREF_PREFIX + "last_site";
|
public static final String PREFS_TAB_QUEUE_LAST_SITE = NON_PREF_PREFIX + "last_site";
|
||||||
public static final String PREFS_TAB_QUEUE_LAST_TIME = NON_PREF_PREFIX + "last_time";
|
public static final String PREFS_TAB_QUEUE_LAST_TIME = NON_PREF_PREFIX + "last_time";
|
||||||
@ -1183,8 +1182,6 @@ OnSharedPreferenceChangeListener
|
|||||||
if (PREFS_BROWSER_LOCALE.equals(key)) {
|
if (PREFS_BROWSER_LOCALE.equals(key)) {
|
||||||
onLocaleSelected(Locales.getLanguageTag(lastLocale),
|
onLocaleSelected(Locales.getLanguageTag(lastLocale),
|
||||||
sharedPreferences.getString(key, null));
|
sharedPreferences.getString(key, null));
|
||||||
} else if (PREFS_SUGGESTED_SITES.equals(key)) {
|
|
||||||
refreshSuggestedSites();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +178,6 @@
|
|||||||
<!ENTITY pref_home_updates2 "Content updates">
|
<!ENTITY pref_home_updates2 "Content updates">
|
||||||
<!ENTITY pref_home_updates_enabled "Enabled">
|
<!ENTITY pref_home_updates_enabled "Enabled">
|
||||||
<!ENTITY pref_home_updates_wifi "Only over Wi-Fi">
|
<!ENTITY pref_home_updates_wifi "Only over Wi-Fi">
|
||||||
<!ENTITY pref_home_suggested_sites "Show site suggestions">
|
|
||||||
<!ENTITY pref_home_suggested_sites_summary "Display shortcuts to sites on your homepage that we think you might find interesting">
|
|
||||||
<!ENTITY pref_category_home_homepage "Homepage">
|
<!ENTITY pref_category_home_homepage "Homepage">
|
||||||
<!ENTITY home_homepage_title "Set a Homepage">
|
<!ENTITY home_homepage_title "Set a Homepage">
|
||||||
<!-- Localization note (home_homepage_radio_user_address): The user will see a series of radio
|
<!-- Localization note (home_homepage_radio_user_address): The user will see a series of radio
|
||||||
|
@ -21,15 +21,6 @@
|
|||||||
<org.mozilla.gecko.preferences.PanelsPreferenceCategory
|
<org.mozilla.gecko.preferences.PanelsPreferenceCategory
|
||||||
android:title="@string/pref_category_home_panels"/>
|
android:title="@string/pref_category_home_panels"/>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_category_home_content_settings">
|
|
||||||
|
|
||||||
<CheckBoxPreference android:key="android.not_a_preference.home_suggested_sites"
|
|
||||||
android:title="@string/pref_home_suggested_sites"
|
|
||||||
android:summary="@string/pref_home_suggested_sites_summary"
|
|
||||||
android:defaultValue="true" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/pref_category_home_add_ons">
|
<PreferenceCategory android:title="@string/pref_category_home_add_ons">
|
||||||
|
|
||||||
<ListPreference android:key="home.sync.updateMode"
|
<ListPreference android:key="home.sync.updateMode"
|
||||||
|
@ -169,8 +169,6 @@
|
|||||||
<string name="pref_category_home_panels">&pref_category_home_panels;</string>
|
<string name="pref_category_home_panels">&pref_category_home_panels;</string>
|
||||||
<string name="pref_category_home_content_settings">&pref_category_home_content_settings;</string>
|
<string name="pref_category_home_content_settings">&pref_category_home_content_settings;</string>
|
||||||
<string name="pref_home_updates_wifi">&pref_home_updates_wifi;</string>
|
<string name="pref_home_updates_wifi">&pref_home_updates_wifi;</string>
|
||||||
<string name="pref_home_suggested_sites">&pref_home_suggested_sites;</string>
|
|
||||||
<string name="pref_home_suggested_sites_summary">&pref_home_suggested_sites_summary;</string>
|
|
||||||
<string name="pref_category_home_add_ons">&pref_category_home_add_ons;</string>
|
<string name="pref_category_home_add_ons">&pref_category_home_add_ons;</string>
|
||||||
<string name="pref_home_updates">&pref_home_updates2;</string>
|
<string name="pref_home_updates">&pref_home_updates2;</string>
|
||||||
<string name="pref_home_updates_enabled">&pref_home_updates_enabled;</string>
|
<string name="pref_home_updates_enabled">&pref_home_updates_enabled;</string>
|
||||||
|
@ -324,24 +324,6 @@ public class TestSuggestedSites extends InstrumentationTestCase {
|
|||||||
c.close();
|
c.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDisabledState() {
|
|
||||||
resources.setSuggestedSitesResource(generateSites(3));
|
|
||||||
|
|
||||||
Cursor c = new SuggestedSites(context).get(DEFAULT_LIMIT);
|
|
||||||
assertEquals(3, c.getCount());
|
|
||||||
c.close();
|
|
||||||
|
|
||||||
// Disable suggested sites
|
|
||||||
GeckoSharedPrefs.forApp(context).edit()
|
|
||||||
.putBoolean(GeckoPreferences.PREFS_SUGGESTED_SITES, false)
|
|
||||||
.commit();
|
|
||||||
|
|
||||||
c = new SuggestedSites(context).get(DEFAULT_LIMIT);
|
|
||||||
assertNotNull(c);
|
|
||||||
assertEquals(0, c.getCount());
|
|
||||||
c.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testImageUrlAndBgColor() {
|
public void testImageUrlAndBgColor() {
|
||||||
final int count = 3;
|
final int count = 3;
|
||||||
resources.setSuggestedSitesResource(generateSites(count));
|
resources.setSuggestedSitesResource(generateSites(count));
|
||||||
|
Loading…
Reference in New Issue
Block a user