summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/privacy_security_preferences.xml6
-rw-r--r--src/com/android/browser/BrowserSettings.java4
-rw-r--r--src/com/android/browser/PreferenceKeys.java1
-rw-r--r--src/com/android/browser/SuggestionsAdapter.java8
5 files changed, 22 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5720410..8121e5c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -485,6 +485,10 @@
<!-- Settings summmary -->
<string name="pref_security_show_security_warning_summary">Show warning if there\'s a problem with a site\'s security</string>
<!-- Settings label -->
+ <string name="pref_security_show_search_suggestions">Show search suggestions</string>
+ <!-- Settings summmary -->
+ <string name="pref_security_show_search_suggestions_summary">Show search suggestions when typing in the URL field</string>
+ <!-- Settings label -->
<string name="pref_security_accept_cookies">Accept cookies</string>
<!-- Settings summary -->
<string name="pref_security_accept_cookies_summary">Allow sites to save and read cookie data</string>
diff --git a/res/xml/privacy_security_preferences.xml b/res/xml/privacy_security_preferences.xml
index 2633600..a574e61 100644
--- a/res/xml/privacy_security_preferences.xml
+++ b/res/xml/privacy_security_preferences.xml
@@ -37,6 +37,12 @@
android:title="@string/pref_security_show_security_warning"
android:summary="@string/pref_security_show_security_warning_summary" />
+ <CheckBoxPreference
+ android:key="show_search_suggestions"
+ android:defaultValue="false"
+ android:title="@string/pref_security_show_search_suggestions"
+ android:summary="@string/pref_security_show_search_suggestions_summary" />
+
<PreferenceCategory android:title="@string/pref_privacy_cookies_title">
<CheckBoxPreference
android:key="accept_cookies"
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index efab039..b514954 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -863,6 +863,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getBoolean(PREF_SHOW_SECURITY_WARNINGS, true);
}
+ public boolean showSearchSuggestions() {
+ return mPrefs.getBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, false);
+ }
+
public boolean acceptCookies() {
return mPrefs.getBoolean(PREF_ACCEPT_COOKIES, true);
}
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index b0bade2..06cff5e 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -100,6 +100,7 @@ public interface PreferenceKeys {
static final String PREF_REMEMBER_PASSWORDS = "remember_passwords";
static final String PREF_SAVE_FORMDATA = "save_formdata";
static final String PREF_SHOW_SECURITY_WARNINGS = "show_security_warnings";
+ static final String PREF_SHOW_SEARCH_SUGGESTIONS = "show_search_suggestions";
// ----------------------
// Keys for bandwidth_preferences.xml
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 9f66e3c..e9aae4a 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -204,9 +204,15 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
@Override
protected List<SuggestItem> doInBackground(CharSequence... params) {
+ List<SuggestItem> results = new ArrayList<SuggestItem>();
+
+ // Don't query the search engine if disabled in settings
+ if (!mSettings.showSearchSuggestions()) {
+ return results;
+ }
+
SuggestCursor cursor = new SuggestCursor();
cursor.runQuery(params[0]);
- List<SuggestItem> results = new ArrayList<SuggestItem>();
int count = cursor.getCount();
for (int i = 0; i < count; i++) {
results.add(cursor.getItem());