OSDN Git Service

Add user-selected search providers to browser
authorBjorn Bringert <bringert@android.com>
Mon, 13 Sep 2010 13:06:41 +0000 (14:06 +0100)
committerandroid-build SharedAccount <android-build@sekiwake.mtv.corp.google.com>
Thu, 16 Sep 2010 20:31:38 +0000 (13:31 -0700)
The lists of search providers are taken from Chrome.

Change-Id: I7af6dc1258950d1fc5cf86013f8be9f3c5db0f1a

48 files changed:
AndroidManifest.xml
res/values-cs-rCZ/search_engines.xml [new file with mode: 0644]
res/values-da-rDK/search_engines.xml [new file with mode: 0644]
res/values-de-rAT/search_engines.xml [new file with mode: 0644]
res/values-de-rCH/search_engines.xml [new file with mode: 0644]
res/values-de-rDE/search_engines.xml [new file with mode: 0644]
res/values-el-rGR/search_engines.xml [new file with mode: 0644]
res/values-en-rAU/search_engines.xml [new file with mode: 0644]
res/values-en-rGB/search_engines.xml [new file with mode: 0644]
res/values-en-rIE/search_engines.xml [new file with mode: 0644]
res/values-en-rNZ/search_engines.xml [new file with mode: 0644]
res/values-en-rSG/search_engines.xml [new file with mode: 0644]
res/values-en-rZA/search_engines.xml [new file with mode: 0644]
res/values-es-rES/search_engines.xml [new file with mode: 0644]
res/values-fr-rBE/search_engines.xml [new file with mode: 0644]
res/values-fr-rFR/search_engines.xml [new file with mode: 0644]
res/values-it-rIT/search_engines.xml [new file with mode: 0644]
res/values-ja-rJP/search_engines.xml [new file with mode: 0644]
res/values-ko-rKR/search_engines.xml [new file with mode: 0644]
res/values-nb-rNO/search_engines.xml [new file with mode: 0644]
res/values-nl-rBE/search_engines.xml [new file with mode: 0644]
res/values-nl-rNL/search_engines.xml [new file with mode: 0644]
res/values-pl-rPL/search_engines.xml [new file with mode: 0644]
res/values-pt-rBR/search_engines.xml [new file with mode: 0644]
res/values-pt-rPT/search_engines.xml [new file with mode: 0644]
res/values-ru-rRU/search_engines.xml [new file with mode: 0644]
res/values-sv-rSE/search_engines.xml [new file with mode: 0644]
res/values-tr-rTR/search_engines.xml [new file with mode: 0644]
res/values-zh-rCN/search_engines.xml [new file with mode: 0644]
res/values-zh-rHK/search_engines.xml [new file with mode: 0644]
res/values-zh-rTW/search_engines.xml [new file with mode: 0644]
res/values/all_search_engines.xml [new file with mode: 0644]
res/values/search_engines.xml [new file with mode: 0644]
res/values/strings.xml
res/xml/browser_preferences.xml
src/com/android/browser/BrowserActivity.java
src/com/android/browser/BrowserPreferencesPage.java
src/com/android/browser/BrowserProvider.java
src/com/android/browser/BrowserSettings.java
src/com/android/browser/search/DefaultSearchEngine.java [new file with mode: 0644]
src/com/android/browser/search/OpenSearchSearchEngine.java [new file with mode: 0644]
src/com/android/browser/search/SearchEngine.java [new file with mode: 0644]
src/com/android/browser/search/SearchEngineInfo.java [new file with mode: 0644]
src/com/android/browser/search/SearchEnginePreference.java [new file with mode: 0644]
src/com/android/browser/search/SearchEngines.java [new file with mode: 0644]
tools/all_search_engines.template.xml [new file with mode: 0644]
tools/get_search_engines.py [new file with mode: 0755]
tools/search_engines.template.xml [new file with mode: 0755]

index 7e98019..36e2820 100644 (file)
@@ -30,6 +30,7 @@
     <uses-permission android:name="android.permission.SET_WALLPAPER" />
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
     <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
     <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
     <uses-permission android:name="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" />
diff --git a/res/values-cs-rCZ/search_engines.xml b/res/values-cs-rCZ/search_engines.xml
new file mode 100644 (file)
index 0000000..5aea8c8
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>seznam</item>
+    <item>bing_cs_CZ</item>
+    <item>centrum_cz</item>
+    <item>atlas_cz</item>
+  </string-array>
+</resources>
diff --git a/res/values-da-rDK/search_engines.xml b/res/values-da-rDK/search_engines.xml
new file mode 100644 (file)
index 0000000..73360b1
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_da_DK</item>
+    <item>yahoo_dk</item>
+  </string-array>
+</resources>
diff --git a/res/values-de-rAT/search_engines.xml b/res/values-de-rAT/search_engines.xml
new file mode 100644 (file)
index 0000000..708d7ed
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_at</item>
+    <item>bing_de_AT</item>
+  </string-array>
+</resources>
diff --git a/res/values-de-rCH/search_engines.xml b/res/values-de-rCH/search_engines.xml
new file mode 100644 (file)
index 0000000..4e2360e
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_ch</item>
+    <item>bing_de_CH</item>
+    <item>bing_fr_CH</item>
+    <item>search_de_CH</item>
+    <item>search_fr_CH</item>
+  </string-array>
+</resources>
diff --git a/res/values-de-rDE/search_engines.xml b/res/values-de-rDE/search_engines.xml
new file mode 100644 (file)
index 0000000..5fdde69
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>ask_de</item>
+    <item>bing_de_DE</item>
+    <item>yahoo_de</item>
+  </string-array>
+</resources>
diff --git a/res/values-el-rGR/search_engines.xml b/res/values-el-rGR/search_engines.xml
new file mode 100644 (file)
index 0000000..8185cf3
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo</item>
+    <item>in</item>
+    <item>bing_el_GR</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rAU/search_engines.xml b/res/values-en-rAU/search_engines.xml
new file mode 100644 (file)
index 0000000..08765ac
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_en_AU</item>
+    <item>yahoo_au</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rGB/search_engines.xml b/res/values-en-rGB/search_engines.xml
new file mode 100644 (file)
index 0000000..b2ee93c
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>ask_uk</item>
+    <item>yahoo_uk</item>
+    <item>bing_en_GB</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rIE/search_engines.xml b/res/values-en-rIE/search_engines.xml
new file mode 100644 (file)
index 0000000..25f3f29
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_uk</item>
+    <item>bing_en_IE</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rNZ/search_engines.xml b/res/values-en-rNZ/search_engines.xml
new file mode 100644 (file)
index 0000000..2044c37
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_nz</item>
+    <item>bing_en_NZ</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rSG/search_engines.xml b/res/values-en-rSG/search_engines.xml
new file mode 100644 (file)
index 0000000..74d6939
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_sg</item>
+    <item>bing_en_SG</item>
+    <item>rednano</item>
+  </string-array>
+</resources>
diff --git a/res/values-en-rZA/search_engines.xml b/res/values-en-rZA/search_engines.xml
new file mode 100644 (file)
index 0000000..bab95c4
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo</item>
+    <item>bing_en_ZA</item>
+  </string-array>
+</resources>
diff --git a/res/values-es-rES/search_engines.xml b/res/values-es-rES/search_engines.xml
new file mode 100644 (file)
index 0000000..053d786
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>ask_es</item>
+    <item>bing_es_ES</item>
+    <item>yahoo_es</item>
+    <item>terra_es</item>
+    <item>hispavista</item>
+  </string-array>
+</resources>
diff --git a/res/values-fr-rBE/search_engines.xml b/res/values-fr-rBE/search_engines.xml
new file mode 100644 (file)
index 0000000..d743fc0
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_nl_BE</item>
+    <item>yahoo</item>
+    <item>bing_fr_BE</item>
+  </string-array>
+</resources>
diff --git a/res/values-fr-rFR/search_engines.xml b/res/values-fr-rFR/search_engines.xml
new file mode 100644 (file)
index 0000000..4a75e4c
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_fr</item>
+    <item>bing_fr_FR</item>
+  </string-array>
+</resources>
diff --git a/res/values-it-rIT/search_engines.xml b/res/values-it-rIT/search_engines.xml
new file mode 100644 (file)
index 0000000..c2be0d4
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>ask_it</item>
+    <item>virgilio</item>
+    <item>bing_it_IT</item>
+    <item>yahoo_it</item>
+    <item>libero</item>
+  </string-array>
+</resources>
diff --git a/res/values-ja-rJP/search_engines.xml b/res/values-ja-rJP/search_engines.xml
new file mode 100644 (file)
index 0000000..03c23f4
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_jp</item>
+    <item>bing_ja_JP</item>
+    <item>goo</item>
+  </string-array>
+</resources>
diff --git a/res/values-ko-rKR/search_engines.xml b/res/values-ko-rKR/search_engines.xml
new file mode 100644 (file)
index 0000000..4f24631
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>naver</item>
+    <item>daum</item>
+    <item>yahoo_kr</item>
+    <item>nate</item>
+  </string-array>
+</resources>
diff --git a/res/values-nb-rNO/search_engines.xml b/res/values-nb-rNO/search_engines.xml
new file mode 100644 (file)
index 0000000..418f6d2
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_nb_NO</item>
+    <item>abcsok</item>
+    <item>yahoo_no</item>
+    <item>kvasir</item>
+  </string-array>
+</resources>
diff --git a/res/values-nl-rBE/search_engines.xml b/res/values-nl-rBE/search_engines.xml
new file mode 100644 (file)
index 0000000..d743fc0
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_nl_BE</item>
+    <item>yahoo</item>
+    <item>bing_fr_BE</item>
+  </string-array>
+</resources>
diff --git a/res/values-nl-rNL/search_engines.xml b/res/values-nl-rNL/search_engines.xml
new file mode 100644 (file)
index 0000000..b9c1b40
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_nl_NL</item>
+    <item>yahoo_nl</item>
+    <item>ask_nl</item>
+  </string-array>
+</resources>
diff --git a/res/values-pl-rPL/search_engines.xml b/res/values-pl-rPL/search_engines.xml
new file mode 100644 (file)
index 0000000..ddc262e
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_pl_PL</item>
+    <item>netsprint</item>
+    <item>yahoo_uk</item>
+    <item>onet</item>
+    <item>wp</item>
+  </string-array>
+</resources>
diff --git a/res/values-pt-rBR/search_engines.xml b/res/values-pt-rBR/search_engines.xml
new file mode 100644 (file)
index 0000000..56cda34
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_pt_BR</item>
+    <item>yahoo_br</item>
+    <item>uol</item>
+  </string-array>
+</resources>
diff --git a/res/values-pt-rPT/search_engines.xml b/res/values-pt-rPT/search_engines.xml
new file mode 100644 (file)
index 0000000..3780d73
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>sapo</item>
+    <item>bing_pt_PT</item>
+    <item>yahoo</item>
+  </string-array>
+</resources>
diff --git a/res/values-ru-rRU/search_engines.xml b/res/values-ru-rRU/search_engines.xml
new file mode 100644 (file)
index 0000000..80ff214
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yandex_ru</item>
+    <item>mail_ru</item>
+    <item>tut</item>
+    <item>rambler</item>
+    <item>bing_ru_RU</item>
+  </string-array>
+</resources>
diff --git a/res/values-sv-rSE/search_engines.xml b/res/values-sv-rSE/search_engines.xml
new file mode 100644 (file)
index 0000000..f216357
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_sv_SE</item>
+    <item>yahoo_se</item>
+    <item>altavista_se</item>
+    <item>spray</item>
+    <item>eniro_se</item>
+  </string-array>
+</resources>
diff --git a/res/values-tr-rTR/search_engines.xml b/res/values-tr-rTR/search_engines.xml
new file mode 100644 (file)
index 0000000..06cdb12
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>bing_tr_TR</item>
+    <item>yahoo</item>
+    <item>mynet</item>
+  </string-array>
+</resources>
diff --git a/res/values-zh-rCN/search_engines.xml b/res/values-zh-rCN/search_engines.xml
new file mode 100644 (file)
index 0000000..c38055c
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>baidu</item>
+    <item>yahoo_cn</item>
+    <item>bing_zh_CN</item>
+  </string-array>
+</resources>
diff --git a/res/values-zh-rHK/search_engines.xml b/res/values-zh-rHK/search_engines.xml
new file mode 100644 (file)
index 0000000..eaf35d5
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_hk</item>
+    <item>bing_zh_HK</item>
+    <item>baidu</item>
+  </string-array>
+</resources>
diff --git a/res/values-zh-rTW/search_engines.xml b/res/values-zh-rTW/search_engines.xml
new file mode 100644 (file)
index 0000000..6d02b43
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo_tw</item>
+    <item>bing_zh_TW</item>
+  </string-array>
+</resources>
diff --git a/res/values/all_search_engines.xml b/res/values/all_search_engines.xml
new file mode 100644 (file)
index 0000000..3a17bd9
--- /dev/null
@@ -0,0 +1,752 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each string-array item below refers to one search engine in a specific locale, and the name of the
+item is referred to by the <engine_X_name> items in the locale specific search_engines.xml file.
+
+Format:
+  - Human readable label
+  - Keyword: empty string if the engine has no keyword. (currently unused)
+  - Favicon URL
+  - Search URL
+  - Encoding
+  - Suggest URL: empty string if this engine has no suggest feature
+
+The parameters enclosed in curly braces come from the OpenSearch specification, see
+http://www.opensearch.org/Specifications/OpenSearch/1.1/Draft_4#OpenSearch_1.1_parameters
+-->
+
+<resources>
+  <string-array name="yahoo_uk" translatable="false">
+    <item>Yahoo! UK &amp; Ireland</item>
+    <item>uk.yahoo.com</item>
+    <item>http://uk.search.yahoo.com/favicon.ico</item>
+    <item>http://uk.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://uk-sayt.ff.search.yahoo.com/gossip-uk-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="yahoo_jp" translatable="false">
+    <item>Yahoo! JAPAN</item>
+    <item>yahoo.co.jp</item>
+    <item>http://search.yahoo.co.jp/favicon.ico</item>
+    <item>http://search.yahoo.co.jp/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="rambler" translatable="false">
+    <item>Rambler</item>
+    <item>rambler.ru</item>
+    <item>http://www.rambler.ru/favicon.ico</item>
+    <item>http://www.rambler.ru/srch?words={searchTerms}</item>
+    <item>windows-1251</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_br" translatable="false">
+    <item>Yahoo! Brasil</item>
+    <item>br.yahoo.com</item>
+    <item>http://br.search.yahoo.com/favicon.ico</item>
+    <item>http://br.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://br-sayt.ff.search.yahoo.com/gossip-br-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_zh_HK" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=zh-HK&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_el_GR" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=el-GR&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_tr_TR" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=tr-TR&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="ask_uk" translatable="false">
+    <item>Ask Jeeves</item>
+    <item>uk.ask.com</item>
+    <item>http://uk.ask.com/favicon.ico</item>
+    <item>http://uk.ask.com/web?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ss.uk.ask.com/query?q={searchTerms}&amp;li=ff</item>
+  </string-array>
+  <string-array name="nate" translatable="false">
+    <item>&#xb124;&#xc774;&#xd2b8;&#xb2f7;&#xcef4;</item>
+    <item>nate.com</item>
+    <item>http://nate.search.empas.com/favicon.ico</item>
+    <item>http://nate.search.empas.com/search/all.html?q={searchTerms}</item>
+    <item>EUC-KR</item>
+    <item></item>
+  </string-array>
+  <string-array name="uol" translatable="false">
+    <item>UOL Busca</item>
+    <item>busca.uol.com.br</item>
+    <item>http://busca.uol.com.br/favicon.ico</item>
+    <item>http://busca.uol.com.br/www/index.html?q={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="baidu" translatable="false">
+    <item>&#x767e;&#x5ea6;</item>
+    <item>baidu.com</item>
+    <item>http://www.baidu.com/favicon.ico</item>
+    <item>http://www.baidu.com/s?wd={searchTerms}</item>
+    <item>GB2312</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_ch" translatable="false">
+    <item>Yahoo! Suche</item>
+    <item>ch.yahoo.com</item>
+    <item>http://ch.search.yahoo.com/favicon.ico</item>
+    <item>http://ch.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_nl_BE" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=nl-BE&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_cn" translatable="false">
+    <item>&#x4e2d;&#x56fd;&#x96c5;&#x864e;</item>
+    <item>cn.yahoo.com</item>
+    <item>http://search.cn.yahoo.com/favicon.ico</item>
+    <item>http://search.cn.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>GB2312</item>
+    <item></item>
+  </string-array>
+  <string-array name="onet" translatable="false">
+    <item>Onet.pl</item>
+    <item>onet.pl</item>
+    <item>http://szukaj.onet.pl/favicon.ico</item>
+    <item>http://szukaj.onet.pl/query.html?qt={searchTerms}</item>
+    <item>ISO-8859-2</item>
+    <item></item>
+  </string-array>
+  <string-array name="ask_es" translatable="false">
+    <item>Ask.com Espa&#x00f1a;</item>
+    <item>es.ask.com</item>
+    <item>http://es.ask.com/favicon.ico</item>
+    <item>http://es.ask.com/web?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ss.es.ask.com/query?q={searchTerms}&amp;li=ff</item>
+  </string-array>
+  <string-array name="bing_cs_CZ" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=cs-CZ&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="altavista_se" translatable="false">
+    <item>AltaVista</item>
+    <item>se.altavista.com</item>
+    <item>http://se.altavista.com/favicon.ico</item>
+    <item>http://se.altavista.com/web/results?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="mail_ru" translatable="false">
+    <item>\@MAIL.RU</item>
+    <item>mail.ru</item>
+    <item>http://img.go.mail.ru/favicon.ico</item>
+    <item>http://go.mail.ru/search?q={searchTerms}</item>
+    <item>windows-1251</item>
+    <item></item>
+  </string-array>
+  <string-array name="hispavista" translatable="false">
+    <item>hispavista</item>
+    <item>hispavista.com</item>
+    <item>http://buscar.hispavista.com/favicon.ico</item>
+    <item>http://buscar.hispavista.com/?cadena={searchTerms}</item>
+    <item>iso-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_zh_CN" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=zh-CN&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="google" translatable="false">
+    <item>Google</item>
+    <item></item>
+    <item>http://www.google.com/favicon.ico</item>
+    <item>{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&amp;ie={inputEncoding}&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>{google:baseSuggestURL}search?client=chrome&amp;hl={language}&amp;q={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_en_NZ" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-NZ&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_fr_BE" translatable="false">
+    <item>Bing</item>
+    <item></item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=fr-BE&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="rednano" translatable="false">
+    <item>Rednano</item>
+    <item>rednano.sg</item>
+    <item>http://rednano.sg/favicon.ico</item>
+    <item>http://rednano.sg/sfe/lwi.action?querystring={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="goo" translatable="false">
+    <item>goo</item>
+    <item>search.goo.ne.jp</item>
+    <item>http://goo.ne.jp/favicon.ico</item>
+    <item>http://search.goo.ne.jp/web.jsp?MT={searchTerms}&amp;IE={inputEncoding}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="sapo" translatable="false">
+    <item>SAPO</item>
+    <item>sapo.pt</item>
+    <item>http://imgs.sapo.pt/images/sapo.ico</item>
+    <item>http://pesquisa.sapo.pt/?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://pesquisa.sapo.pt/livesapo?q={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_it_IT" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=it-IT&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_es_ES" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=es-ES&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="abcsok" translatable="false">
+    <item>ABC S&#x00f8;k</item>
+    <item>abcsok.no</item>
+    <item>http://abcsok.no/favicon.ico</item>
+    <item>http://abcsok.no/index.html?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_dk" translatable="false">
+    <item>Yahoo! Danmark</item>
+    <item>dk.yahoo.com</item>
+    <item>http://dk.search.yahoo.com/favicon.ico</item>
+    <item>http://dk.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_de" translatable="false">
+    <item>Yahoo! Deutschland</item>
+    <item>de.yahoo.com</item>
+    <item>http://de.search.yahoo.com/favicon.ico</item>
+    <item>http://de.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://de-sayt.ff.search.yahoo.com/gossip-de-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_de_AT" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=de-AT&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_pl_PL" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=pl-PL&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="tut" translatable="false">
+    <item>TUT.BY</item>
+    <item>tut.by</item>
+    <item>http://www.tut.by/favicon.ico</item>
+    <item>http://search.tut.by/?query={searchTerms}</item>
+    <item>windows-1251</item>
+    <item></item>
+  </string-array>
+  <string-array name="spray" translatable="false">
+    <item>Spray</item>
+    <item>spray.se</item>
+    <item>http://www.eniro.se/favicon.ico</item>
+    <item>http://www.eniro.se/query?ax=spray&amp;search_word={searchTerms}&amp;what=web</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="wp" translatable="false">
+    <item>Wirtualna Polska</item>
+    <item>wp.pl</item>
+    <item>http://szukaj.wp.pl/favicon.ico</item>
+    <item>http://szukaj.wp.pl/szukaj.html?szukaj={searchTerms}</item>
+    <item>ISO-8859-2</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_tw" translatable="false">
+    <item>Yahoo!&#x5947;&#x6469;</item>
+    <item>tw.yahoo.com</item>
+    <item>http://tw.search.yahoo.com/favicon.ico</item>
+    <item>http://tw.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="atlas_cz" translatable="false">
+    <item>Atlas</item>
+    <item>atlas.cz</item>
+    <item>http://img.atlas.cz/favicon.ico</item>
+    <item>http://search.atlas.cz/?q={searchTerms}</item>
+    <item>windows-1250</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_en_GB" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-GB&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_es" translatable="false">
+    <item>Yahoo! Espa&#x00f1a;</item>
+    <item>es.yahoo.com</item>
+    <item>http://es.search.yahoo.com/favicon.ico</item>
+    <item>http://es.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://es-sayt.ff.search.yahoo.com/gossip-es-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="libero" translatable="false">
+    <item>Libero</item>
+    <item>libero.it</item>
+    <item>http://arianna.libero.it/favicon.ico</item>
+    <item>http://arianna.libero.it/search/abin/integrata.cgi?query={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_sv_SE" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=sv-SE&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_nz" translatable="false">
+    <item>Yahoo!Xtra</item>
+    <item>nz.yahoo.com</item>
+    <item>http://nz.search.yahoo.com/favicon.ico</item>
+    <item>http://nz.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://aue-sayt.ff.search.yahoo.com/gossip-nz-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="terra_es" translatable="false">
+    <item>Terra</item>
+    <item>terra.es</item>
+    <item>http://buscador.terra.es/favicon.ico</item>
+    <item>http://buscador.terra.es/Default.aspx?query={searchTerms}&amp;source=Search</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_nl" translatable="false">
+    <item>Yahoo! Nederland</item>
+    <item>nl.yahoo.com</item>
+    <item>http://nl.search.yahoo.com/favicon.ico</item>
+    <item>http://nl.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_no" translatable="false">
+    <item>Yahoo! Norge</item>
+    <item>no.yahoo.com</item>
+    <item>http://no.search.yahoo.com/favicon.ico</item>
+    <item>http://no.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="daum" translatable="false">
+    <item>Daum</item>
+    <item>daum.net</item>
+    <item>http://search.daum.net/favicon.ico</item>
+    <item>http://search.daum.net/search?q={searchTerms}</item>
+    <item>EUC-KR</item>
+    <item>http://sug.search.daum.net/search_nsuggest?mod=fxjson&amp;q={searchTerms}</item>
+  </string-array>
+  <string-array name="yahoo_fr" translatable="false">
+    <item>Yahoo! France</item>
+    <item>fr.yahoo.com</item>
+    <item>http://fr.search.yahoo.com/favicon.ico</item>
+    <item>http://fr.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://fr-sayt.ff.search.yahoo.com/gossip-fr-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="ask_nl" translatable="false">
+    <item>Ask.com Nederland</item>
+    <item>nl.ask.com</item>
+    <item>http://nl.ask.com/favicon.ico</item>
+    <item>http://nl.ask.com/web?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ss.nl.ask.com/query?q={searchTerms}&amp;li=ff</item>
+  </string-array>
+  <string-array name="seznam" translatable="false">
+    <item>Seznam</item>
+    <item>seznam.cz</item>
+    <item>http://1.im.cz/szn/img/favicon.ico</item>
+    <item>http://search.seznam.cz/?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http:///suggest.fulltext.seznam.cz/?dict=fulltext_ff&amp;phrase={searchTerms}&amp;encoding={inputEncoding}&amp;response_encoding=utf-8</item>
+  </string-array>
+  <string-array name="centrum_cz" translatable="false">
+    <item>Centrum.cz</item>
+    <item>centrum.cz</item>
+    <item>http://img.centrum.cz/6/vy2/o/favicon.ico</item>
+    <item>http://search.centrum.cz/index.php?charset={inputEncoding}&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="eniro_se" translatable="false">
+    <item>Eniro</item>
+    <item>eniro.se</item>
+    <item>http://eniro.se/favicon.ico</item>
+    <item>http://eniro.se/query?search_word={searchTerms}&amp;what=web_local</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="kvasir" translatable="false">
+    <item>Kvasir</item>
+    <item>kvasir.no</item>
+    <item>http://www.kvasir.no/img/favicon.ico</item>
+    <item>http://www.kvasir.no/nettsok/searchResult.html?searchExpr={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo" translatable="false">
+    <item>Yahoo!</item>
+    <item>yahoo.com</item>
+    <item>http://search.yahoo.com/favicon.ico</item>
+    <item>http://search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_en_IE" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-IE&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_pt_PT" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=pt-PT&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_de_CH" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=de-CH&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_nl_NL" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=nl-NL&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_fr_CH" translatable="false">
+    <item>Bing</item>
+    <item></item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=fr-CH&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_zh_TW" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=zh-TW&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_ru_RU" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=ru-RU&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_en_AU" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-AU&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing_da_DK" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=da-DK&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="ask_it" translatable="false">
+    <item>Ask.com Italia</item>
+    <item>it.ask.com</item>
+    <item>http://it.ask.com/favicon.ico</item>
+    <item>http://it.ask.com/web?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ss.it.ask.com/query?q={searchTerms}&amp;li=ff</item>
+  </string-array>
+  <string-array name="yandex_ru" translatable="false">
+    <item>&#x042f;&#x043d;&#x0434;&#x0435;&#x043a;&#x0441;</item>
+    <item>yandex.ru</item>
+    <item>http://yandex.ru/favicon.ico</item>
+    <item>http://yandex.ru/yandsearch?text={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://suggest.yandex.net/suggest-ff.cgi?part={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_ja_JP" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=ja-JP&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_kr" translatable="false">
+    <item>&#xc57c;&#xd6c4;! &#xcf54;&#xb9ac;&#xc544;</item>
+    <item>kr.yahoo.com</item>
+    <item>http://kr.search.yahoo.com/favicon.ico</item>
+    <item>http://kr.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://kr.atc.search.yahoo.com/atcx.php?property=main&amp;ot=fxjson&amp;ei=utf8&amp;eo=utf8&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="ask_de" translatable="false">
+    <item>Ask.com Deutschland</item>
+    <item>de.ask.com</item>
+    <item>http://de.ask.com/favicon.ico</item>
+    <item>http://de.ask.com/web?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ss.de.ask.com/query?q={searchTerms}&amp;li=ff</item>
+  </string-array>
+  <string-array name="yahoo_hk" translatable="false">
+    <item>Yahoo! Hong Kong</item>
+    <item>hk.yahoo.com</item>
+    <item>http://hk.search.yahoo.com/favicon.ico</item>
+    <item>http://hk.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_fr_FR" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=fr-FR&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="in" translatable="false">
+    <item>in.gr</item>
+    <item>in.gr</item>
+    <item>http://www.in.gr/favicon.ico</item>
+    <item>http://find.in.gr/?qs={searchTerms}</item>
+    <item>ISO-8859-7</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_nb_NO" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=nb-NO&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_sg" translatable="false">
+    <item>Yahoo! Singapore</item>
+    <item>sg.yahoo.com</item>
+    <item>http://sg.search.yahoo.com/favicon.ico</item>
+    <item>http://sg.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://sg-sayt.ff.search.yahoo.com/gossip-sg-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="yahoo_se" translatable="false">
+    <item>Yahoo! Sverige</item>
+    <item>se.yahoo.com</item>
+    <item>http://se.search.yahoo.com/favicon.ico</item>
+    <item>http://se.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_de_DE" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=de-DE&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="search_de_CH" translatable="false">
+    <item>search.ch</item>
+    <item>search.ch</item>
+    <item>http://www.search.ch/favicon.ico</item>
+    <item>http://www.search.ch/index.de.html?q={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="mynet" translatable="false">
+    <item>MYNET</item>
+    <item>mynet.com</item>
+    <item>http://img.mynet.com/mynetfavori.ico</item>
+    <item>http://arama.mynet.com/search.aspx?q={searchTerms}&amp;pg=q</item>
+    <item>windows-1254</item>
+    <item></item>
+  </string-array>
+  <string-array name="search_fr_CH" translatable="false">
+    <item>search.ch</item>
+    <item></item>
+    <item>http://www.search.ch/favicon.ico</item>
+    <item>http://www.search.ch/index.fr.html?q={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="virgilio" translatable="false">
+    <item>Virgilio</item>
+    <item>virgilio.it</item>
+    <item>http://ricerca.alice.it/favicon.ico</item>
+    <item>http://ricerca.alice.it/ricerca?qs={searchTerms}</item>
+    <item>ISO-8859-1</item>
+    <item></item>
+  </string-array>
+  <string-array name="bing_en_SG" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-SG&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="yahoo_it" translatable="false">
+    <item>Yahoo! Italia</item>
+    <item>it.yahoo.com</item>
+    <item>http://it.search.yahoo.com/favicon.ico</item>
+    <item>http://it.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://it-sayt.ff.search.yahoo.com/gossip-it-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="yahoo_at" translatable="false">
+    <item>Yahoo! Suche</item>
+    <item>at.yahoo.com</item>
+    <item>http://at.search.yahoo.com/favicon.ico</item>
+    <item>http://at.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="yahoo_au" translatable="false">
+    <item>Yahoo!7</item>
+    <item>au.yahoo.com</item>
+    <item>http://au.search.yahoo.com/favicon.ico</item>
+    <item>http://au.search.yahoo.com/search?ei={inputEncoding}&amp;fr=crmas&amp;p={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://aue-sayt.ff.search.yahoo.com/gossip-au-sayt?output=fxjson&amp;command={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_pt_BR" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=pt-BR&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="bing" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+  <string-array name="netsprint" translatable="false">
+    <item>NetSprint</item>
+    <item>netsprint.pl</item>
+    <item>http://netsprint.pl/favicon.ico</item>
+    <item>http://www.netsprint.pl/serwis/search?q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item></item>
+  </string-array>
+  <string-array name="naver" translatable="false">
+    <item>&#xb124;&#xc774;&#xbc84;</item>
+    <item>naver.com</item>
+    <item>http://search.naver.com/favicon.ico</item>
+    <item>http://search.naver.com/search.naver?ie={inputEncoding}&amp;query={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://ac.search.naver.com/autocompl?m=s&amp;ie={inputEncoding}&amp;oe=utf-8&amp;q={searchTerms}</item>
+  </string-array>
+  <string-array name="bing_en_ZA" translatable="false">
+    <item>Bing</item>
+    <item>bing.com</item>
+    <item>http://www.bing.com/s/wlflag.ico</item>
+    <item>http://www.bing.com/search?setmkt=en-ZA&amp;q={searchTerms}</item>
+    <item>UTF-8</item>
+    <item>http://api.bing.com/osjson.aspx?query={searchTerms}&amp;language={language}</item>
+  </string-array>
+</resources>
+
diff --git a/res/values/search_engines.xml b/res/values/search_engines.xml
new file mode 100644 (file)
index 0000000..c6ed9ca
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+  <string-array name="search_engines" translatable="false">
+    <item>google</item>
+    <item>yahoo</item>
+    <item>bing</item>
+  </string-array>
+</resources>
index 18a2144..f852167 100644 (file)
     <string name="pref_content_open_in_background_summary">Open new windows behind the current one</string>
     <!-- Settings label -->
     <string name="pref_content_homepage">Set home page</string>
+    <!-- Settings label -->
+    <string name="pref_content_search_engine">Set search engine</string>
+    <!-- Settings summary -->
+    <string name="pref_content_search_engine_summary">Select a search engine</string>
+    <!-- Settings label -->
+    <string name="pref_content_show_search_suggestions">Show web suggestions</string>
+    <!-- Settings summary -->
+    <string name="pref_content_show_web_suggestions_summary_on">Show web suggestions as you type</string>
+    <!-- Settings summary -->
+    <string name="pref_content_show_web_suggestions_summary_off">Don\'t show web suggestions as you type</string>
     <!-- Settings button label -->
     <string name="pref_use_current">Use current page</string>
     <!-- Settings label -->
index ee1b306..fd994e8 100644 (file)
                 android:hint="@string/http"
                 android:inputType="textUri|textMultiLine" />
 
+        <!-- Entries and values in this list are set dynamically. -->
+        <com.android.browser.search.SearchEnginePreference
+                android:key="search_engine"
+                android:title="@string/pref_content_search_engine"
+                android:summary="@string/pref_content_search_engine_summary"
+                android:dialogTitle="@string/pref_content_search_engine" />
+
+        <CheckBoxPreference
+                android:key="show_search_suggestions"
+                android:defaultValue="true"
+                android:title="@string/pref_content_show_search_suggestions"
+                android:summaryOn="@string/pref_content_show_web_suggestions_summary_on"
+                android:summaryOff="@string/pref_content_show_web_suggestions_summary_off" />
+
     </PreferenceCategory>
 
     <PreferenceCategory
index 5e55789..6f47788 100644 (file)
@@ -111,6 +111,7 @@ import android.accounts.AuthenticatorException;
 import android.accounts.OperationCanceledException;
 import android.accounts.AccountManagerCallback;
 
+import com.android.browser.search.SearchEngine;
 import com.android.common.Search;
 import com.android.common.speech.LoggingEvents;
 
@@ -619,17 +620,9 @@ public class BrowserActivity extends Activity
             }
         }.execute();
 
-        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
-        intent.addCategory(Intent.CATEGORY_DEFAULT);
-        intent.putExtra(SearchManager.QUERY, url);
-        if (appData != null) {
-            intent.putExtra(SearchManager.APP_DATA, appData);
-        }
-        if (extraData != null) {
-            intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData);
-        }
-        intent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName());
-        startActivity(intent);
+        SearchEngine searchEngine = mSettings.getSearchEngine();
+        if (searchEngine == null) return false;
+        searchEngine.startSearch(this, url, appData, extraData);
 
         return true;
     }
index 6426b99..9af66f1 100644 (file)
 
 package com.android.browser;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
 import android.preference.EditTextPreference;
-import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceScreen;
-import android.util.Log;
 import android.webkit.GeolocationPermissions;
 import android.webkit.ValueCallback;
 import android.webkit.WebStorage;
-import android.webkit.WebView;
+
+import java.util.Map;
+import java.util.Set;
 
 public class BrowserPreferencesPage extends PreferenceActivity
         implements Preference.OnPreferenceChangeListener {
@@ -119,6 +114,7 @@ public class BrowserPreferencesPage extends PreferenceActivity
 
         // sync the shared preferences back to BrowserSettings
         BrowserSettings.getInstance().syncSharedPreferences(
+                getApplicationContext(),
                 getPreferenceScreen().getSharedPreferences());
     }
 
index bf1f9d5..96745e5 100644 (file)
 
 package com.android.browser;
 
+import com.android.browser.search.SearchEngine;
+
 import android.app.SearchManager;
-import android.app.SearchableInfo;
 import android.app.backup.BackupManager;
-import android.content.ComponentName;
 import android.content.ContentProvider;
 import android.content.ContentResolver;
 import android.content.ContentUris;
@@ -27,28 +27,21 @@ import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
-import android.content.UriMatcher;
 import android.content.SharedPreferences.Editor;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
+import android.content.UriMatcher;
 import android.database.AbstractCursor;
-import android.database.ContentObserver;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.net.Uri;
-import android.os.Handler;
 import android.os.Process;
 import android.preference.PreferenceManager;
 import android.provider.Browser;
-import android.provider.Settings;
 import android.provider.Browser.BookmarkColumns;
 import android.speech.RecognizerResultsIntent;
 import android.text.TextUtils;
 import android.util.Log;
 import android.util.Patterns;
-import android.util.TypedValue;
-
 
 import java.io.File;
 import java.io.FilenameFilter;
@@ -165,7 +158,7 @@ public class BrowserProvider extends ContentProvider {
     // optionally a trailing slash, all matched as separate groups.
     private static final Pattern STRIP_URL_PATTERN = Pattern.compile("^(http://)(.*?)(/$)?");
 
-    private SearchManager mSearchManager;
+    private BrowserSettings mSettings;
 
     public BrowserProvider() {
     }
@@ -366,59 +359,10 @@ public class BrowserProvider extends ContentProvider {
                 ed.commit();
             }
         }
-        mSearchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
-        mShowWebSuggestionsSettingChangeObserver
-            = new ShowWebSuggestionsSettingChangeObserver();
-        context.getContentResolver().registerContentObserver(
-                Settings.System.getUriFor(
-                        Settings.System.SHOW_WEB_SUGGESTIONS),
-                true, mShowWebSuggestionsSettingChangeObserver);
-        updateShowWebSuggestions();
+        mSettings = BrowserSettings.getInstance();
         return true;
     }
 
-    /**
-     * This Observer will ensure that if the user changes the system
-     * setting of whether to display web suggestions, we will
-     * change accordingly.
-     */
-    /* package */ class ShowWebSuggestionsSettingChangeObserver
-            extends ContentObserver {
-        public ShowWebSuggestionsSettingChangeObserver() {
-            super(new Handler());
-        }
-
-        @Override
-        public void onChange(boolean selfChange) {
-            updateShowWebSuggestions();
-        }
-    }
-
-    private ShowWebSuggestionsSettingChangeObserver
-            mShowWebSuggestionsSettingChangeObserver;
-
-    // If non-null, then the system is set to show web suggestions,
-    // and this is the SearchableInfo to use to get them.
-    private SearchableInfo mSearchableInfo;
-
-    /**
-     * Check the system settings to see whether web suggestions are
-     * allowed.  If so, store the SearchableInfo to grab suggestions
-     * while the user is typing.
-     */
-    private void updateShowWebSuggestions() {
-        mSearchableInfo = null;
-        Context context = getContext();
-        if (Settings.System.getInt(context.getContentResolver(),
-                Settings.System.SHOW_WEB_SUGGESTIONS,
-                1 /* default on */) == 1) {
-            ComponentName webSearchComponent = mSearchManager.getWebSearchActivity();
-            if (webSearchComponent != null) {
-                mSearchableInfo = mSearchManager.getSearchableInfo(webSearchComponent);
-            }
-        }
-    }
-
     private void fixPicasaBookmark() {
         SQLiteDatabase db = mOpenHelper.getWritableDatabase();
         Cursor cursor = db.rawQuery("SELECT _id FROM bookmarks WHERE " +
@@ -875,12 +819,15 @@ public class BrowserProvider extends ContentProvider {
                     || Patterns.WEB_URL.matcher(selectionArgs[0]).matches()) {
                 return new MySuggestionCursor(c, null, "");
             } else {
-                // get Google suggest if there is still space in the list
+                // get search suggestions if there is still space in the list
                 if (myArgs != null && myArgs.length > 1
-                        && mSearchableInfo != null
+                        && mSettings.getShowSearchSuggestions()
                         && c.getCount() < (MAX_SUGGESTION_SHORT_ENTRIES - 1)) {
-                    Cursor sc = mSearchManager.getSuggestions(mSearchableInfo, selectionArgs[0]);
-                    return new MySuggestionCursor(c, sc, selectionArgs[0]);
+                    SearchEngine searchEngine = mSettings.getSearchEngine();
+                    if (searchEngine != null && searchEngine.supportsSuggestions()) {
+                        Cursor sc = searchEngine.getSuggestions(getContext(), selectionArgs[0]);
+                        return new MySuggestionCursor(c, sc, selectionArgs[0]);
+                    }
                 }
                 return new MySuggestionCursor(c, null, selectionArgs[0]);
             }
index 51b4eaa..6263eb3 100644 (file)
 
 package com.android.browser;
 
+import com.android.browser.search.SearchEngine;
+import com.android.browser.search.SearchEngines;
+
 import android.app.ActivityManager;
+import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.pm.ActivityInfo;
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
+import android.database.ContentObserver;
+import android.os.Handler;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceScreen;
+import android.provider.Settings;
+import android.util.Log;
 import android.webkit.CookieManager;
 import android.webkit.GeolocationPermissions;
 import android.webkit.ValueCallback;
@@ -71,6 +79,8 @@ class BrowserSettings extends Observable {
     private boolean openInBackground;
     private String defaultTextEncodingName;
     private String homeUrl = "";
+    private SearchEngine searchEngine;
+    private boolean showSearchSuggestions;
     private boolean autoFitPage;
     private boolean landscapeOnly;
     private boolean loadsPageInOverviewMode;
@@ -121,6 +131,8 @@ class BrowserSettings extends Observable {
     public final static String PREF_CLEAR_COOKIES = "privacy_clear_cookies";
     public final static String PREF_CLEAR_HISTORY = "privacy_clear_history";
     public final static String PREF_HOMEPAGE = "homepage";
+    public final static String PREF_SEARCH_ENGINE = "search_engine";
+    public final static String PREF_SHOW_SEARCH_SUGGESTIONS = "show_search_suggestions";
     public final static String PREF_CLEAR_FORM_DATA =
             "privacy_clear_form_data";
     public final static String PREF_CLEAR_PASSWORDS =
@@ -234,7 +246,7 @@ class BrowserSettings extends Observable {
      *            stored in this BrowserSettings object. This will update all
      *            observers of this object.
      */
-    public void loadFromDb(Context ctx) {
+    public void loadFromDb(final Context ctx) {
         SharedPreferences p =
                 PreferenceManager.getDefaultSharedPreferences(ctx);
         // Set the default value for the Application Caches path.
@@ -266,17 +278,41 @@ class BrowserSettings extends Observable {
             pageCacheCapacity = 1;
         }
 
-        // Load the defaults from the xml
+        final ContentResolver cr = ctx.getContentResolver();
+        cr.registerContentObserver(
+                Settings.System.getUriFor(Settings.System.SHOW_WEB_SUGGESTIONS), false,
+                new ContentObserver(new Handler()) {
+                        @Override
+                        public void onChange(boolean selfChange) {
+                            SharedPreferences p =
+                                    PreferenceManager.getDefaultSharedPreferences(ctx);
+                            updateShowWebSuggestions(cr, p);
+                        }
+                });
+        updateShowWebSuggestions(cr, p);
+
+    // Load the defaults from the xml
         // This call is TOO SLOW, need to manually keep the defaults
         // in sync
         //PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences);
-        syncSharedPreferences(p);
+        syncSharedPreferences(ctx, p);
     }
 
-    /* package */ void syncSharedPreferences(SharedPreferences p) {
+    /* package */ void syncSharedPreferences(Context ctx, SharedPreferences p) {
 
         homeUrl =
             p.getString(PREF_HOMEPAGE, homeUrl);
+        String searchEngineName = p.getString(PREF_SEARCH_ENGINE, null);
+        if (searchEngine == null || !searchEngine.getName().equals(searchEngineName)) {
+            if (searchEngine != null) {
+                searchEngine.close();
+            }
+            searchEngine = SearchEngines.get(ctx, searchEngineName);
+        }
+        Log.i(TAG, "Selected search engine: " + searchEngine);
+        showSearchSuggestions = p.getBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, true);
+        // Persist to system settings
+        saveShowWebSuggestions(ctx.getContentResolver());
 
         loadsImagesAutomatically = p.getBoolean("load_images",
                 loadsImagesAutomatically);
@@ -365,10 +401,30 @@ class BrowserSettings extends Observable {
         update();
     }
 
+    private void saveShowWebSuggestions(ContentResolver cr) {
+        int value = showSearchSuggestions ? 1 : 0;
+        Settings.System.putInt(cr, Settings.System.SHOW_WEB_SUGGESTIONS, value);
+    }
+
+    private void updateShowWebSuggestions(ContentResolver cr, SharedPreferences p) {
+        showSearchSuggestions =
+                Settings.System.getInt(cr,
+                        Settings.System.SHOW_WEB_SUGGESTIONS, 1) == 1;
+        p.edit().putBoolean(PREF_SHOW_SEARCH_SUGGESTIONS, showSearchSuggestions).commit();
+    }
+
     public String getHomePage() {
         return homeUrl;
     }
 
+    public SearchEngine getSearchEngine() {
+        return searchEngine;
+    }
+
+    public boolean getShowSearchSuggestions() {
+        return showSearchSuggestions;
+    }
+
     public String getJsFlags() {
         return jsFlags;
     }
diff --git a/src/com/android/browser/search/DefaultSearchEngine.java b/src/com/android/browser/search/DefaultSearchEngine.java
new file mode 100644 (file)
index 0000000..42d274d
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import android.app.SearchManager;
+import android.app.SearchableInfo;
+import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.provider.Browser;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class DefaultSearchEngine implements SearchEngine {
+
+    private static final String TAG = "DefaultSearchEngine";
+
+    private final SearchableInfo mSearchable;
+
+    private final CharSequence mLabel;
+
+    private DefaultSearchEngine(Context context, SearchableInfo searchable) {
+        mSearchable = searchable;
+        mLabel = loadLabel(context, mSearchable.getSearchActivity());
+    }
+
+    public static DefaultSearchEngine create(Context context) {
+        SearchManager searchManager =
+                (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
+        ComponentName name = searchManager.getWebSearchActivity();
+        if (name == null) return null;
+        SearchableInfo searchable = searchManager.getSearchableInfo(name);
+        if (searchable == null) return null;
+        return new DefaultSearchEngine(context, searchable);
+    }
+
+    private CharSequence loadLabel(Context context, ComponentName activityName) {
+        PackageManager pm = context.getPackageManager();
+        try {
+            ActivityInfo ai = pm.getActivityInfo(activityName, 0);
+            return ai.loadLabel(pm);
+        } catch (PackageManager.NameNotFoundException ex) {
+            Log.e(TAG, "Web search activity not found: " + activityName);
+            return null;
+        }
+    }
+
+    public String getName() {
+        String packageName = mSearchable.getSearchActivity().getPackageName();
+        // Use "google" as name to avoid showing Google twice (app + OpenSearch)
+        if ("com.google.android.googlequicksearchbox".equals(packageName)) {
+            return "google";
+        } else if ("com.android.quicksearchbox".equals(packageName)) {
+            return "google";
+        } else {
+            return packageName;
+        }
+    }
+
+    public CharSequence getLabel() {
+        return mLabel;
+    }
+
+    public void startSearch(Context context, String query, Bundle appData, String extraData) {
+        try {
+            Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
+            intent.addCategory(Intent.CATEGORY_DEFAULT);
+            intent.putExtra(SearchManager.QUERY, query);
+            if (appData != null) {
+                intent.putExtra(SearchManager.APP_DATA, appData);
+            }
+            if (extraData != null) {
+                intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData);
+            }
+            intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
+            context.startActivity(intent);
+        } catch (ActivityNotFoundException ex) {
+            Log.e(TAG, "Web search activity not found: " + mSearchable.getSearchActivity());
+        }
+    }
+
+    public Cursor getSuggestions(Context context, String query) {
+        SearchManager searchManager =
+                (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
+        return searchManager.getSuggestions(mSearchable, query);
+    }
+
+    public boolean supportsSuggestions() {
+        return !TextUtils.isEmpty(mSearchable.getSuggestAuthority());
+    }
+
+    public void close() {
+    }
+
+    @Override
+    public String toString() {
+        return "ActivitySearchEngine{" + mSearchable + "}";
+    }
+
+}
diff --git a/src/com/android/browser/search/OpenSearchSearchEngine.java b/src/com/android/browser/search/OpenSearchSearchEngine.java
new file mode 100644 (file)
index 0000000..e78a93c
--- /dev/null
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import com.android.browser.R;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.params.HttpParams;
+import org.apache.http.util.EntityUtils;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.app.SearchManager;
+import android.content.Context;
+import android.content.Intent;
+import android.database.AbstractCursor;
+import android.database.Cursor;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.Uri;
+import android.net.http.AndroidHttpClient;
+import android.os.Bundle;
+import android.provider.Browser;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Provides search suggestions, if any, for a given web search provider.
+ */
+public class OpenSearchSearchEngine implements SearchEngine {
+
+    private static final String TAG = "OpenSearchSearchEngine";
+
+    private static final String USER_AGENT = "Android/1.0";
+    private static final int HTTP_TIMEOUT_MS = 1000;
+
+    // TODO: this should be defined somewhere
+    private static final String HTTP_TIMEOUT = "http.connection-manager.timeout";
+
+    // Indices of the columns in the below arrays.
+    private static final int COLUMN_INDEX_ID = 0;
+    private static final int COLUMN_INDEX_QUERY = 1;
+    private static final int COLUMN_INDEX_ICON = 2;
+    private static final int COLUMN_INDEX_TEXT_1 = 3;
+    private static final int COLUMN_INDEX_TEXT_2 = 4;
+
+    // The suggestion columns used. If you are adding a new entry to these arrays make sure to
+    // update the list of indices declared above.
+    private static final String[] COLUMNS = new String[] {
+        "_id",
+        SearchManager.SUGGEST_COLUMN_QUERY,
+        SearchManager.SUGGEST_COLUMN_ICON_1,
+        SearchManager.SUGGEST_COLUMN_TEXT_1,
+        SearchManager.SUGGEST_COLUMN_TEXT_2,
+    };
+
+    private static final String[] COLUMNS_WITHOUT_DESCRIPTION = new String[] {
+        "_id",
+        SearchManager.SUGGEST_COLUMN_QUERY,
+        SearchManager.SUGGEST_COLUMN_ICON_1,
+        SearchManager.SUGGEST_COLUMN_TEXT_1,
+    };
+
+    private final SearchEngineInfo mSearchEngineInfo;
+
+    private final AndroidHttpClient mHttpClient;
+
+    public OpenSearchSearchEngine(Context context, SearchEngineInfo searchEngineInfo) {
+        mSearchEngineInfo = searchEngineInfo;
+        mHttpClient = AndroidHttpClient.newInstance(USER_AGENT);
+        HttpParams params = mHttpClient.getParams();
+        params.setLongParameter(HTTP_TIMEOUT, HTTP_TIMEOUT_MS);
+    }
+
+    public String getName() {
+        return mSearchEngineInfo.getName();
+    }
+
+    public CharSequence getLabel() {
+        return mSearchEngineInfo.getLabel();
+    }
+
+    public void startSearch(Context context, String query, Bundle appData, String extraData) {
+        String uri = mSearchEngineInfo.getSearchUriForQuery(query);
+        if (uri == null) {
+            Log.e(TAG, "Unable to get search URI for " + mSearchEngineInfo);
+        } else {
+            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
+            // Make sure the intent goes to the Browser itself
+            intent.setPackage(context.getPackageName());
+            intent.addCategory(Intent.CATEGORY_DEFAULT);
+            intent.putExtra(SearchManager.QUERY, query);
+            if (appData != null) {
+                intent.putExtra(SearchManager.APP_DATA, appData);
+            }
+            if (extraData != null) {
+                intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData);
+            }
+            intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
+            context.startActivity(intent);
+        }
+    }
+
+    /**
+     * Queries for a given search term and returns a cursor containing
+     * suggestions ordered by best match.
+     */
+    public Cursor getSuggestions(Context context, String query) {
+        if (TextUtils.isEmpty(query)) {
+            return null;
+        }
+        if (!isNetworkConnected(context)) {
+            Log.i(TAG, "Not connected to network.");
+            return null;
+        }
+
+        String suggestUri = mSearchEngineInfo.getSuggestUriForQuery(query);
+        if (TextUtils.isEmpty(suggestUri)) {
+            // No suggest URI available for this engine
+            return null;
+        }
+
+        try {
+            String content = readUrl(suggestUri);
+            if (content == null) return null;
+            /* The data format is a JSON array with items being regular strings or JSON arrays
+             * themselves. We are interested in the second and third elements, both of which
+             * should be JSON arrays. The second element/array contains the suggestions and the
+             * third element contains the descriptions. Some search engines don't support
+             * suggestion descriptions so the third element is optional.
+             */
+            JSONArray results = new JSONArray(content);
+            JSONArray suggestions = results.getJSONArray(1);
+            JSONArray descriptions = null;
+            if (results.length() > 2) {
+                descriptions = results.getJSONArray(2);
+                // Some search engines given an empty array "[]" for descriptions instead of
+                // not including it in the response.
+                if (descriptions.length() == 0) {
+                    descriptions = null;
+                }
+            }
+            return new SuggestionsCursor(suggestions, descriptions);
+        } catch (JSONException e) {
+            Log.w(TAG, "Error", e);
+        }
+        return null;
+    }
+
+    /**
+     * Executes a GET request and returns the response content.
+     *
+     * @param url Request URI.
+     * @param requestHeaders Request headers.
+     * @return The response content. This is the empty string if the response
+     *         contained no content.
+     */
+    public String readUrl(String url) {
+        try {
+            HttpGet method = new HttpGet(url);
+            HttpResponse response = mHttpClient.execute(method);
+            if (response.getStatusLine().getStatusCode() == 200) {
+                return EntityUtils.toString(response.getEntity());
+            } else {
+                Log.i(TAG, "Suggestion request failed");
+                return null;
+            }
+        } catch (IOException e) {
+            Log.w(TAG, "Error", e);
+            return null;
+        }
+    }
+
+    public boolean supportsSuggestions() {
+        return mSearchEngineInfo.supportsSuggestions();
+    }
+
+    public void close() {
+        mHttpClient.close();
+    }
+
+    private boolean isNetworkConnected(Context context) {
+        NetworkInfo networkInfo = getActiveNetworkInfo(context);
+        return networkInfo != null && networkInfo.isConnected();
+    }
+
+    private NetworkInfo getActiveNetworkInfo(Context context) {
+        ConnectivityManager connectivity =
+                (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+        if (connectivity == null) {
+            return null;
+        }
+        return connectivity.getActiveNetworkInfo();
+    }
+
+    private static class SuggestionsCursor extends AbstractCursor {
+
+        private final JSONArray mSuggestions;
+
+        private final JSONArray mDescriptions;
+
+        public SuggestionsCursor(JSONArray suggestions, JSONArray descriptions) {
+            mSuggestions = suggestions;
+            mDescriptions = descriptions;
+        }
+
+        @Override
+        public int getCount() {
+            return mSuggestions.length();
+        }
+
+        @Override
+        public String[] getColumnNames() {
+            return (mDescriptions != null ? COLUMNS : COLUMNS_WITHOUT_DESCRIPTION);
+        }
+
+        @Override
+        public String getString(int column) {
+            if (mPos != -1) {
+                if ((column == COLUMN_INDEX_QUERY) || (column == COLUMN_INDEX_TEXT_1)) {
+                    try {
+                        return mSuggestions.getString(mPos);
+                    } catch (JSONException e) {
+                        Log.w(TAG, "Error", e);
+                    }
+                } else if (column == COLUMN_INDEX_TEXT_2) {
+                    try {
+                        return mDescriptions.getString(mPos);
+                    } catch (JSONException e) {
+                        Log.w(TAG, "Error", e);
+                    }
+                } else if (column == COLUMN_INDEX_ICON) {
+                    return String.valueOf(R.drawable.magnifying_glass);
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public double getDouble(int column) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public float getFloat(int column) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int getInt(int column) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public long getLong(int column) {
+            if (column == COLUMN_INDEX_ID) {
+                return mPos;        // use row# as the _Id
+            }
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public short getShort(int column) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean isNull(int column) {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "OpenSearchSearchEngine{" + mSearchEngineInfo + "}";
+    }
+
+}
diff --git a/src/com/android/browser/search/SearchEngine.java b/src/com/android/browser/search/SearchEngine.java
new file mode 100644 (file)
index 0000000..3d24d2e
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.os.Bundle;
+
+/**
+ * Interface for search engines.
+ */
+public interface SearchEngine {
+
+    /**
+     * Gets the unique name of this search engine.
+     */
+    public String getName();
+
+    /**
+     * Gets the human-readable name of this search engine.
+     */
+    public CharSequence getLabel();
+
+    /**
+     * Starts a search.
+     */
+    public void startSearch(Context context, String query, Bundle appData, String extraData);
+
+    /**
+     * Gets search suggestions.
+     */
+    public Cursor getSuggestions(Context context, String query);
+
+    /**
+     * Checks whether this search engine supports search suggestions.
+     */
+    public boolean supportsSuggestions();
+
+    /**
+     * Closes this search engine.
+     */
+    public void close();
+
+}
diff --git a/src/com/android/browser/search/SearchEngineInfo.java b/src/com/android/browser/search/SearchEngineInfo.java
new file mode 100644 (file)
index 0000000..6f0b1d5
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Locale;
+
+/**
+ * Loads and holds data for a given web search engine.
+ */
+public class SearchEngineInfo {
+
+    private static String TAG = "SearchEngineInfo";
+
+    // The fields of a search engine data array, defined in the same order as they appear in the
+    // all_search_engines.xml file.
+    // If you are adding/removing to this list, remember to update NUM_FIELDS below.
+    private static final int FIELD_LABEL = 0;
+    private static final int FIELD_KEYWORD = 1;
+    private static final int FIELD_FAVICON_URI = 2;
+    private static final int FIELD_SEARCH_URI = 3;
+    private static final int FIELD_ENCODING = 4;
+    private static final int FIELD_SUGGEST_URI = 5;
+    private static final int NUM_FIELDS = 6;
+
+    // The OpenSearch URI template parameters that we support.
+    private static final String PARAMETER_LANGUAGE = "{language}";
+    private static final String PARAMETER_SEARCH_TERMS = "{searchTerms}";
+    private static final String PARAMETER_INPUT_ENCODING = "{inputEncoding}";
+
+    private final String mName;
+
+    // The array of strings defining this search engine. The array values are in the same order as
+    // the above enumeration definition.
+    private final String[] mSearchEngineData;
+
+    /**
+     * @throws IllegalArgumentException If the name does not refer to a valid search engine
+     */
+    public SearchEngineInfo(Context context, String name) throws IllegalArgumentException {
+        mName = name;
+
+        Resources res = context.getResources();
+        int id_data = res.getIdentifier(name, "array", context.getPackageName());
+        mSearchEngineData = res.getStringArray(id_data);
+
+        if (mSearchEngineData == null) {
+            throw new IllegalArgumentException("No data found for " + name);
+        }
+        if (mSearchEngineData.length != NUM_FIELDS) {
+                throw new IllegalArgumentException(
+                        name + " has invalid number of fields - " + mSearchEngineData.length);
+        }
+        if (TextUtils.isEmpty(mSearchEngineData[FIELD_SEARCH_URI])) {
+            throw new IllegalArgumentException(name + " has an empty search URI");
+        }
+
+        // Add the current language/country information to the URIs.
+        Locale locale = context.getResources().getConfiguration().locale;
+        StringBuilder language = new StringBuilder(locale.getLanguage());
+        if (!TextUtils.isEmpty(locale.getCountry())) {
+            language.append('-');
+            language.append(locale.getCountry());
+        }
+
+        String language_str = language.toString();
+        mSearchEngineData[FIELD_SEARCH_URI] =
+                mSearchEngineData[FIELD_SEARCH_URI].replace(PARAMETER_LANGUAGE, language_str);
+        mSearchEngineData[FIELD_SUGGEST_URI] =
+                mSearchEngineData[FIELD_SUGGEST_URI].replace(PARAMETER_LANGUAGE, language_str);
+
+        // Default to UTF-8 if not specified.
+        String enc = mSearchEngineData[FIELD_ENCODING];
+        if (TextUtils.isEmpty(enc)) {
+            enc = "UTF-8";
+            mSearchEngineData[FIELD_ENCODING] = enc;
+        }
+
+        // Add the input encoding method to the URI.
+        mSearchEngineData[FIELD_SEARCH_URI] =
+                mSearchEngineData[FIELD_SEARCH_URI].replace(PARAMETER_INPUT_ENCODING, enc);
+        mSearchEngineData[FIELD_SUGGEST_URI] =
+                mSearchEngineData[FIELD_SUGGEST_URI].replace(PARAMETER_INPUT_ENCODING, enc);
+    }
+
+    public String getName() {
+        return mName;
+    }
+
+    public String getLabel() {
+        return mSearchEngineData[FIELD_LABEL];
+    }
+
+    /**
+     * Returns the URI for launching a web search with the given query (or null if there was no
+     * data available for this search engine).
+     */
+    public String getSearchUriForQuery(String query) {
+        return getFormattedUri(searchUri(), query);
+    }
+
+    /**
+     * Returns the URI for retrieving web search suggestions for the given query (or null if there
+     * was no data available for this search engine).
+     */
+    public String getSuggestUriForQuery(String query) {
+        return getFormattedUri(suggestUri(), query);
+    }
+
+    public boolean supportsSuggestions() {
+        return !TextUtils.isEmpty(suggestUri());
+    }
+
+    public String faviconUri() {
+        return mSearchEngineData[FIELD_FAVICON_URI];
+    }
+
+    private String suggestUri() {
+        return mSearchEngineData[FIELD_SUGGEST_URI];
+    }
+
+    private String searchUri() {
+        return mSearchEngineData[FIELD_SEARCH_URI];
+    }
+
+    /**
+     * Formats a launchable uri out of the template uri by replacing the template parameters with
+     * actual values.
+     */
+    private String getFormattedUri(String templateUri, String query) {
+        if (TextUtils.isEmpty(templateUri)) {
+            return null;
+        }
+
+        // Encode the query terms in the requested encoding (and fallback to UTF-8 if not).
+        String enc = mSearchEngineData[FIELD_ENCODING];
+        try {
+            return templateUri.replace(PARAMETER_SEARCH_TERMS, URLEncoder.encode(query, enc));
+        } catch (java.io.UnsupportedEncodingException e) {
+            Log.e(TAG, "Exception occured when encoding query " + query + " to " + enc);
+            return null;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "SearchEngineInfo{" + Arrays.toString(mSearchEngineData) + "}";
+    }
+
+}
diff --git a/src/com/android/browser/search/SearchEnginePreference.java b/src/com/android/browser/search/SearchEnginePreference.java
new file mode 100644 (file)
index 0000000..18ce495
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import com.android.browser.R;
+
+import android.app.SearchManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.preference.ListPreference;
+import android.util.AttributeSet;
+import android.util.Log;
+
+import java.util.ArrayList;
+
+class SearchEnginePreference extends ListPreference {
+
+    private static final String TAG = "SearchEnginePreference";
+
+    public SearchEnginePreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        ArrayList<CharSequence> entryValues = new ArrayList<CharSequence>();
+        ArrayList<CharSequence> entries = new ArrayList<CharSequence>();
+
+        SearchEngine defaultSearchEngine = SearchEngines.getDefaultSearchEngine(context);
+        String defaultSearchEngineName = null;
+        if (defaultSearchEngine != null) {
+            defaultSearchEngineName = defaultSearchEngine.getName();
+            entryValues.add(defaultSearchEngineName);
+            entries.add(defaultSearchEngine.getLabel());
+        }
+        for (SearchEngineInfo searchEngineInfo : SearchEngines.getSearchEngineInfos(context)) {
+            String name = searchEngineInfo.getName();
+            // Skip entry with same name as default provider
+            if (!name.equals(defaultSearchEngineName)) {
+                entryValues.add(name);
+                entries.add(searchEngineInfo.getLabel());
+            }
+        }
+
+        setEntryValues(entryValues.toArray(new CharSequence[entryValues.size()]));
+        setEntries(entries.toArray(new CharSequence[entries.size()]));
+    }
+
+}
diff --git a/src/com/android/browser/search/SearchEngines.java b/src/com/android/browser/search/SearchEngines.java
new file mode 100644 (file)
index 0000000..62690e7
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 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.search;
+
+import com.android.browser.R;
+
+import android.app.SearchManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SearchEngines {
+
+    private static final String TAG = "SearchEngines";
+
+    public static SearchEngine getDefaultSearchEngine(Context context) {
+        return DefaultSearchEngine.create(context);
+    }
+
+    public static List<SearchEngineInfo> getSearchEngineInfos(Context context) {
+        ArrayList<SearchEngineInfo> searchEngineInfos = new ArrayList<SearchEngineInfo>();
+        Resources res = context.getResources();
+        String[] searchEngines = res.getStringArray(R.array.search_engines);
+        for (int i = 0; i < searchEngines.length; i++) {
+            String name = searchEngines[i];
+            SearchEngineInfo info = new SearchEngineInfo(context, name);
+            searchEngineInfos.add(info);
+        }
+        return searchEngineInfos;
+    }
+
+    public static SearchEngine get(Context context, String name) {
+        // TODO: cache
+        SearchEngine defaultSearchEngine = getDefaultSearchEngine(context);
+        if (TextUtils.isEmpty(name)
+                || (defaultSearchEngine != null && name.equals(defaultSearchEngine.getName()))) {
+            return defaultSearchEngine;
+        }
+        SearchEngineInfo searchEngineInfo = getSearchEngineInfo(context, name);
+        if (searchEngineInfo == null) return defaultSearchEngine;
+        return new OpenSearchSearchEngine(context, searchEngineInfo);
+    }
+
+    private static SearchEngineInfo getSearchEngineInfo(Context context, String name) {
+        try {
+            return new SearchEngineInfo(context, name);
+        } catch (IllegalArgumentException exception) {
+            Log.e(TAG, "Cannot load search engine " + name, exception);
+            return null;
+        }
+    }
+
+}
diff --git a/tools/all_search_engines.template.xml b/tools/all_search_engines.template.xml
new file mode 100644 (file)
index 0000000..a8d0c89
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each string-array item below refers to one search engine in a specific locale, and the name of the
+item is referred to by the <engine_X_name> items in the locale specific search_engines.xml file.
+
+Format:
+  - Human readable label
+  - Keyword: empty string if the engine has no keyword. (currently unused)
+  - Favicon URL
+  - Search URL
+  - Encoding
+  - Suggest URL: empty string if this engine has no suggest feature
+
+The parameters enclosed in curly braces come from the OpenSearch specification, see
+http://www.opensearch.org/Specifications/OpenSearch/1.1/Draft_4#OpenSearch_1.1_parameters
+-->
+
+<resources>
+</resources>
+
diff --git a/tools/get_search_engines.py b/tools/get_search_engines.py
new file mode 100755 (executable)
index 0000000..2eecec3
--- /dev/null
@@ -0,0 +1,258 @@
+#!/usr/bin/python2.4
+#
+# Copyright (C) 2010 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.
+#
+"""
+Creates the list of search engines
+
+The created list is placed in the res/values-<locale> directory. Also updates
+res/values/all_search_engines.xml if required with new data.
+
+Usage: get_search_engines.py
+
+Copyright (C) 2010 The Android Open Source Project
+"""
+
+import os
+import re
+import sys
+import urllib
+from xml.dom import minidom
+
+# Locales to generate search engine lists for
+locales = ["cs-CZ", "da-DK", "de-AT", "de-CH", "de-DE", "el-GR", "en-AU",
+    "en-GB", "en-IE", "en-NZ", "en-SG", "en-ZA", "es-ES", "fr-BE", "fr-FR",
+    "it-IT", "ja-JP", "ko-KR", "nb-NO", "nl-BE", "nl-NL", "pl-PL", "pt-PT",
+    "pt-BR", "ru-RU", "sv-SE", "tr-TR", "zh-CN", "zh-HK", "zh-MO", "zh-TW"]
+
+class SearchEngineManager(object):
+  """Manages list of search engines and creates locale specific lists.
+
+  The main method useful for the caller is generateListForLocale(), which
+  creates a locale specific search_engines.xml file suitable for use by the
+  Android WebSearchProvider implementation.
+  """
+
+  def __init__(self):
+    """Inits SearchEngineManager with relevant search engine data.
+
+    The search engine data is downloaded from the Chrome source repository.
+    """
+    self.chrome_data = urllib.urlopen(
+        'http://src.chromium.org/viewvc/chrome/trunk/src/chrome/'
+        'browser/search_engines/template_url_prepopulate_data.cc').read()
+    if self.chrome_data.lower().find('repository not found') != -1:
+      print 'Unable to get Chrome source data for search engine list.\nExiting.'
+      sys.exit(2)
+
+    self.resdir = os.path.normpath(os.path.join(sys.path[0], '../res'))
+
+    self.all_engines = set()
+
+  def getXmlString(self, str):
+    """Returns an XML-safe string for the given string.
+
+    Given a string from the search engine data structure, convert it to a
+    string suitable to write to our XML data file by stripping away NULLs,
+    unwanted quotes, wide-string declarations (L"") and replacing C-style
+    unicode characters with XML equivalents.
+    """
+    str = str.strip()
+    if str.upper() == 'NULL':
+      return ''
+
+    if str.startswith('L"'):
+      str = str[2:]
+    if str.startswith('@') or str.startswith('?'):
+      str = '\\' + str
+
+    str = str.strip('"')
+    str = str.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
+    str = str.replace('"', '&quot;').replace('\'', '&apos;')
+    str = re.sub(r'\\x([a-fA-F0-9]+)', r'&#x\1;', str)
+
+    return str
+
+  def getEngineData(self, name):
+    """Returns an array of strings describing the specified search engine.
+
+    The returned strings are in the same order as in the Chrome source data file
+    except that the internal name of the search engine is inserted at the
+    beginning of the list.
+    """
+    # Find the first occurance of this search engine name in the form
+    # " <name> =" in the chrome data file.
+    re_exp = '\s' + name + '\s*='
+    search_obj = re.search(re_exp, self.chrome_data)
+    if not search_obj:
+      print ('Unable to find data for search engine ' + name +
+             '. Please check the chrome data file for format changes.')
+      return None
+
+    # Extract the struct declaration between the curly braces.
+    start_pos = self.chrome_data.find('{', search_obj.start()) + 1;
+    end_pos = self.chrome_data.find('};', start_pos);
+    engine_data_str = self.chrome_data[start_pos:end_pos]
+
+    # Remove c++ style '//' comments at the ends of each line
+    engine_data_lines = engine_data_str.split('\n')
+    engine_data_str = ""
+    for line in engine_data_lines:
+        start_pos = line.find(' // ')
+        if start_pos != -1:
+            line = line[:start_pos]
+        engine_data_str = engine_data_str + line + '\n'
+
+    # Join multiple line strings into a single string.
+    engine_data_str = re.sub('\"\s+\"', '', engine_data_str)
+    engine_data_str = re.sub('\"\s+L\"', '', engine_data_str)
+    engine_data_str = engine_data_str.replace('"L"', '')
+
+    engine_data = engine_data_str.split(',')
+    for i in range(len(engine_data)):
+      engine_data[i] = self.getXmlString(engine_data[i])
+
+    # If the last element was an empty string (due to an extra comma at the
+    # end), ignore it.
+    if not engine_data[len(engine_data) - 1]:
+      engine_data.pop()
+
+    engine_data.insert(0, name)
+
+    return engine_data
+
+  def getSearchEnginesForCountry(self, country):
+    """Returns the list of search engine names for the given country.
+
+    The data comes from the Chrome data file.
+    """
+    # The Chrome data file has an array defined with the name 'engines_XX'
+    # where XX = country.
+    pos = self.chrome_data.find('engines_' + country)
+    if pos == -1:
+      print ('Unable to find search engine data for country ' + country + '.')
+      return
+
+    # Extract the text between the curly braces for this array declaration
+    engines_start = self.chrome_data.find('{', pos) + 1;
+    engines_end = self.chrome_data.find('}', engines_start);
+    engines_str = self.chrome_data[engines_start:engines_end]
+
+    # Remove embedded /**/ style comments, white spaces, address-of operators
+    # and the trailing comma if any.
+    engines_str = re.sub('\/\*.+\*\/', '', engines_str)
+    engines_str = re.sub('\s+', '', engines_str)
+    engines_str = engines_str.replace('&','')
+    engines_str = engines_str.rstrip(',')
+
+    # Split the array into it's elements
+    engines = engines_str.split(',')
+
+    return engines
+
+  def writeAllEngines(self):
+    """Writes all search engines to the all_search_engines.xml file.
+    """
+
+    all_search_engines_path = os.path.join(self.resdir, 'values/all_search_engines.xml')
+
+    text = []
+
+    for engine_name in self.all_engines:
+      engine_data = self.getEngineData(engine_name)
+      text.append('  <string-array name="%s" translatable="false">\n' % (engine_data[0]))
+      for i in range(1, 7):
+        text.append('    <item>%s</item>\n' % (engine_data[i]))
+      text.append('  </string-array>\n')
+      print engine_data[1] + " added to all_search_engines.xml"
+
+    self.generateXmlFromTemplate(os.path.join(sys.path[0], 'all_search_engines.template.xml'),
+        all_search_engines_path, text)
+
+  def generateDefaultList(self):
+    self.writeEngineList(os.path.join(self.resdir, 'values'), "default")
+
+  def generateListForLocale(self, locale):
+    """Creates a new locale specific search_engines.xml file.
+
+    The new file contains search engines specific to that country. If required
+    this function updates all_search_engines.xml file with any new search
+    engine data necessary.
+    """
+    separator_pos = locale.find('-')
+    if separator_pos == -1:
+      print ('Locale must be of format <language>-<country>. For e.g.'
+             ' "es-US" or "en-GB"')
+      return
+
+    language = locale[0:separator_pos]
+    country = locale[separator_pos + 1:].upper()
+    dir_path = os.path.join(self.resdir, 'values-' + language + '-r' + country)
+
+    self.writeEngineList(dir_path, country)
+
+  def writeEngineList(self, dir_path, country):
+    if os.path.exists(dir_path) and not os.path.isdir(dir_path):
+      print "File exists in output directory path " + dir_path + ". Please remove it and try again."
+      return
+
+    engines = self.getSearchEnginesForCountry(country)
+    if not engines:
+      return
+    for engine in engines:
+      self.all_engines.add(engine)
+
+    # Create the locale specific search_engines.xml file. Each
+    # search_engines.xml file has a hardcoded list of 7 items. If there are less
+    # than 7 search engines for this country, the remaining items are marked as
+    # enabled=false.
+    text = []
+    text.append('  <string-array name="search_engines" translatable="false">\n');
+    for engine in engines:
+      engine_data = self.getEngineData(engine)
+      name = engine_data[0]
+      text.append('    <item>%s</item>\n' % (name))
+    text.append('  </string-array>\n');
+
+    self.generateXmlFromTemplate(os.path.join(sys.path[0], 'search_engines.template.xml'),
+        os.path.join(dir_path, 'search_engines.xml'),
+        text)
+
+  def generateXmlFromTemplate(self, template_path, out_path, text):
+    # Load the template file and insert the new contents before the last line.
+    template_text = open(template_path).read()
+    pos = template_text.rfind('\n', 0, -2) + 1
+    contents = template_text[0:pos] + ''.join(text) + template_text[pos:]
+
+    # Make sure what we have created is valid XML :) No need to check for errors
+    # as the script will terminate with an exception if the XML was malformed.
+    engines_dom = minidom.parseString(contents)
+
+    dir_path = os.path.dirname(out_path)
+    if not os.path.exists(dir_path):
+      os.makedirs(dir_path)
+      print 'Created directory ' + dir_path
+    file = open(out_path, 'w')
+    file.write(contents)
+    file.close()
+    print 'Wrote ' + out_path
+
+if __name__ == "__main__":
+  manager = SearchEngineManager()
+  manager.generateDefaultList()
+  for locale in locales:
+    manager.generateListForLocale(locale)
+  manager.writeAllEngines()
+
diff --git a/tools/search_engines.template.xml b/tools/search_engines.template.xml
new file mode 100755 (executable)
index 0000000..553d333
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+<!--
+****
+**** THIS FILE WAS GENERATED BY tools/get_search_engines.py
+****
+
+Each value in the string-array is the name of a value in all_search_engines.xml
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+</resources>