summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/debug_preferences.xml5
-rw-r--r--src/com/android/browser/BrowserActivity.java68
-rw-r--r--src/com/android/browser/BrowserSearchpagePreference.java68
-rw-r--r--src/com/android/browser/BrowserSettings.java7
5 files changed, 4 insertions, 146 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index eae6ccc..7872f73 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -404,8 +404,6 @@
<!-- Do not tranlsate. Development option -->
<string name="pref_development_nav_dump" translatable="false">Enable nav cache dump</string>
<!-- Do not tranlsate. Development option -->
- <string name="pref_development_search_url" translatable="false">Set search URL</string>
- <!-- Do not tranlsate. Development option -->
<string name="pref_development_uastring" translatable="false">UAString</string>
<!-- Do not tranlsate. Development option -->
<string-array name="pref_development_ua_choices" translatable="false">
diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml
index 4f55f6b..22b5997 100644
--- a/res/xml/debug_preferences.xml
+++ b/res/xml/debug_preferences.xml
@@ -50,11 +50,6 @@
android:defaultValue="false"
android:title="@string/pref_development_nav_dump" />
- <com.android.browser.BrowserSearchpagePreference
- android:key="search_url"
- android:title="@string/pref_development_search_url"
- android:singleLine="true" />
-
<ListPreference
android:key="user_agent"
android:title="@string/pref_development_uastring"
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 84e7ca3..d0fa0bd 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -18,7 +18,6 @@ package com.android.browser;
import com.google.android.googleapps.IGoogleLoginService;
import com.google.android.googlelogin.GoogleLoginServiceConstants;
-import com.google.android.providers.GoogleSettings.Partner;
import android.app.Activity;
import android.app.ActivityManager;
@@ -57,8 +56,6 @@ import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.PaintDrawable;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
-import android.location.Location;
-import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.net.WebAddress;
@@ -77,13 +74,10 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.preference.PreferenceManager;
import android.provider.Browser;
import android.provider.Contacts;
import android.provider.Downloads;
import android.provider.MediaStore;
-import android.provider.Settings;
import android.provider.Contacts.Intents.Insert;
import android.text.IClipboard;
import android.text.TextUtils;
@@ -142,7 +136,6 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedList;
-import java.util.Locale;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -658,9 +651,6 @@ public class BrowserActivity extends Activity
mResolver = getContentResolver();
- setBaseSearchUrl(PreferenceManager.getDefaultSharedPreferences(this)
- .getString("search_url", ""));
-
//
// start MASF proxy service
//
@@ -4584,7 +4574,7 @@ public class BrowserActivity extends Activity
String query = inUrl.substring(2);
switch (shortcut) {
case SHORTCUT_GOOGLE_SEARCH:
- return composeSearchUrl(query);
+ return URLUtil.composeSearchUrl(query, QuickSearch_G, QUERY_PLACE_HOLDER);
case SHORTCUT_WIKIPEDIA_SEARCH:
return URLUtil.composeSearchUrl(query, QuickSearch_W, QUERY_PLACE_HOLDER);
case SHORTCUT_DICTIONARY_SEARCH:
@@ -4601,56 +4591,7 @@ public class BrowserActivity extends Activity
}
Browser.addSearchUrl(mResolver, inUrl);
- return composeSearchUrl(inUrl);
- }
-
- /* package */ String composeSearchUrl(String search) {
- return URLUtil.composeSearchUrl(search, QuickSearch_G,
- QUERY_PLACE_HOLDER);
- }
-
- /* package */void setBaseSearchUrl(String url) {
- if (url == null || url.length() == 0) {
- /*
- * get the google search url based on the SIM. Default is US. NOTE:
- * This code uses resources to optionally select the search Uri,
- * based on the MCC value from the SIM. The default string will most
- * likely be fine. It is parameterized to accept info from the
- * Locale, the language code is the first parameter (%1$s) and the
- * country code is the second (%2$s). This code must function in the
- * same way as a similar lookup in
- * com.android.googlesearch.SuggestionProvider#onCreate(). If you
- * change either of these functions, change them both. (The same is
- * true for the underlying resource strings, which are stored in
- * mcc-specific xml files.)
- */
- Locale l = Locale.getDefault();
- String language = l.getLanguage();
- String country = l.getCountry().toLowerCase();
- // Chinese and Portuguese have two langauge variants.
- if ("zh".equals(language)) {
- if ("cn".equals(country)) {
- language = "zh-CN";
- } else if ("tw".equals(country)) {
- language = "zh-TW";
- }
- } else if ("pt".equals(language)) {
- if ("br".equals(country)) {
- language = "pt-BR";
- } else if ("pt".equals(country)) {
- language = "pt-PT";
- }
- }
- QuickSearch_G = getResources().getString(
- R.string.google_search_base,
- language,
- country)
- + "client=ms-"
- + Partner.getString(this.getContentResolver(), Partner.CLIENT_ID)
- + "&source=android-" + GOOGLE_SEARCH_SOURCE_SUGGEST + "&q=%s";
- } else {
- QuickSearch_G = url;
- }
+ return URLUtil.composeSearchUrl(inUrl, QuickSearch_G, QUERY_PLACE_HOLDER);
}
private final static int LOCK_ICON_UNSECURE = 0;
@@ -4760,9 +4701,8 @@ public class BrowserActivity extends Activity
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
- // We may provide UI to customize these
- // Google search from the browser
- static String QuickSearch_G;
+ // Google search
+ final static String QuickSearch_G = "http://www.google.com/m?q=%s";
// Wikipedia search
final static String QuickSearch_W = "http://en.wikipedia.org/w/index.php?search=%s&go=Go";
// Dictionary search
diff --git a/src/com/android/browser/BrowserSearchpagePreference.java b/src/com/android/browser/BrowserSearchpagePreference.java
deleted file mode 100644
index 09e8993..0000000
--- a/src/com/android/browser/BrowserSearchpagePreference.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.browser;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.preference.EditTextPreference;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.text.util.Regex;
-import android.util.AttributeSet;
-
-public class BrowserSearchpagePreference extends EditTextPreference implements
- TextWatcher {
-
- public BrowserSearchpagePreference(Context context, AttributeSet attrs,
- int defStyle) {
- super(context, attrs, defStyle);
- getEditText().addTextChangedListener(this);
- }
-
- public BrowserSearchpagePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- getEditText().addTextChangedListener(this);
- }
-
- public BrowserSearchpagePreference(Context context) {
- super(context);
- getEditText().addTextChangedListener(this);
- }
-
- public void afterTextChanged(Editable s) {
- AlertDialog dialog = (AlertDialog) getDialog();
- // This callback is called before the dialog has been fully constructed
- if (dialog != null) {
- String string = s.toString();
- int length = string.length();
- int first = length > 0 ? string
- .indexOf(BrowserActivity.QUERY_PLACE_HOLDER) : -1;
- int last = length > 0 ? string
- .lastIndexOf(BrowserActivity.QUERY_PLACE_HOLDER) : -1;
- dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(
- length == 0 || (first > 0 && first == last));
- }
- }
-
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
- }
-
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
-}
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index d80fedf..a5e23c9 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -18,15 +18,10 @@ package com.android.browser;
import com.google.android.providers.GoogleSettings.Partner;
-import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.pm.ActivityInfo;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
-import android.os.SystemProperties;
-import android.view.WindowManager;
-import android.webkit.CacheManager;
import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewDatabase;
@@ -278,8 +273,6 @@ class BrowserSettings extends Observable {
navDump = p.getBoolean("enable_nav_dump", navDump);
doFlick = p.getBoolean("enable_flick", doFlick);
userAgent = Integer.parseInt(p.getString("user_agent", "0"));
- mTabControl.getBrowserActivity().setBaseSearchUrl(
- p.getString("search_url", ""));
}
update();
}