Merge "Fix potential NPE when saving/deleting Autofill profile."
diff --git a/res/drawable-hdpi/ic_menu_findonpage_normal.png b/res/drawable-hdpi/ic_menu_findonpage_normal.png
deleted file mode 100644
index 91da8d5..0000000
--- a/res/drawable-hdpi/ic_menu_findonpage_normal.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_findonpage_normal.png b/res/drawable-mdpi/ic_menu_findonpage_normal.png
deleted file mode 100644
index 030e3fa..0000000
--- a/res/drawable-mdpi/ic_menu_findonpage_normal.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_findonpage_normal.png b/res/drawable-xhdpi/ic_menu_findonpage_normal.png
deleted file mode 100644
index 287b029..0000000
--- a/res/drawable-xhdpi/ic_menu_findonpage_normal.png
+++ /dev/null
Binary files differ
diff --git a/res/menu-sw600dp/browser.xml b/res/menu-sw600dp/browser.xml
deleted file mode 100644
index 29b6117..0000000
--- a/res/menu-sw600dp/browser.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?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.
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <group android:id="@+id/MAIN_MENU">
- <item android:id="@+id/new_tab_menu_id"
- android:icon="@drawable/ic_menu_new_window"
- android:title="@string/new_tab"
- android:showAsAction="never"
- android:alphabeticShortcut="n" />
- <item android:id="@+id/incognito_menu_id"
- android:title="@string/new_incognito_tab"
- android:icon="@drawable/ic_incognito_holo_dark" />
- <item android:id="@+id/find_menu_id"
- android:title="@*android:string/find_on_page"
- android:icon="@drawable/ic_menu_findonpage_normal"
- android:alphabeticShortcut="f" />
- <item android:id="@+id/share_page_menu_id"
- android:title="@string/share_page"
- android:icon="@drawable/ic_share_holo_dark"
- android:alphabeticShortcut="s" />
- <item android:id="@+id/save_snapshot_menu_id"
- android:title="@string/menu_save_snapshot" />
- <item android:id="@+id/page_info_menu_id"
- android:title="@string/page_info"
- android:icon="@drawable/ic_pageinfo_holo_dark"
- android:alphabeticShortcut="g" />
- <item android:id="@+id/view_downloads_menu_id"
- android:title="@string/menu_view_download"
- android:icon="@drawable/ic_downloads_holo_dark"
- android:alphabeticShortcut="j" />
- <item android:id="@+id/preferences_menu_id"
- android:title="@string/menu_preferences"
- android:icon="@drawable/ic_settings_holo_dark"
- android:alphabeticShortcut="p" />
- <!-- followings are debug only -->
- <item android:id="@+id/dump_nav_menu_id"
- android:title="@string/dump_nav"
- android:visible="false" />
- <item android:id="@+id/dump_counters_menu_id"
- android:title="@string/dump_counters"
- android:visible="false" />
- </group>
- <group android:id="@+id/MAIN_SHORTCUT_MENU" android:visible="false">
- <item android:id="@+id/homepage_menu_id"
- android:alphabeticShortcut=" " />
- <item android:id="@+id/classic_history_menu_id"
- android:alphabeticShortcut="h" />
- <item android:id="@+id/zoom_in_menu_id"
- android:alphabeticShortcut="i" />
- <item android:id="@+id/zoom_out_menu_id"
- android:alphabeticShortcut="o" />
- <item android:id="@+id/window_one_menu_id"
- android:alphabeticShortcut="1" />
- <item android:id="@+id/window_two_menu_id"
- android:alphabeticShortcut="2" />
- <item android:id="@+id/window_three_menu_id"
- android:alphabeticShortcut="3" />
- <item android:id="@+id/window_four_menu_id"
- android:alphabeticShortcut="4" />
- <item android:id="@+id/window_five_menu_id"
- android:alphabeticShortcut="5" />
- <item android:id="@+id/window_six_menu_id"
- android:alphabeticShortcut="6" />
- <item android:id="@+id/window_seven_menu_id"
- android:alphabeticShortcut="7" />
- <item android:id="@+id/window_eight_menu_id"
- android:alphabeticShortcut="8" />
- <item android:id="@+id/back_menu_id" />
- <item android:id="@+id/forward_menu_id" />
- <item android:id="@+id/bookmarks_menu_id"
- android:alphabeticShortcut="b" />
- <item android:id="@+id/add_bookmark_menu_id"
- android:alphabeticShortcut="d" />
- <item android:id="@+id/stop_reload_menu_id"
- android:alphabeticShortcut="r" />
- <item android:id="@+id/goto_menu_id"
- android:alphabeticShortcut="l" />
- <item android:id="@+id/close_menu_id"
- android:alphabeticShortcut="w" />
- </group>
-</menu>
diff --git a/res/menu/browser.xml b/res/menu/browser.xml
index 1de97f7..d5bdf04 100644
--- a/res/menu/browser.xml
+++ b/res/menu/browser.xml
@@ -18,7 +18,8 @@
<group
android:id="@+id/MAIN_MENU">
<group
- android:id="@+id/NAV_MENU">
+ android:id="@+id/NAV_MENU"
+ android:visible="@bool/menu_show_navigation">
<item
android:id="@+id/stop_reload_menu_id"
android:alphabeticShortcut="r" />
@@ -29,21 +30,26 @@
</group>
<item
android:id="@+id/new_tab_menu_id"
- android:title="@string/menu_new_tab"
- android:icon="@drawable/ic_new_window_holo_dark" />
+ android:title="@string/new_tab"
+ android:icon="@drawable/ic_new_window_holo_dark"
+ android:showAsAction="never"
+ android:alphabeticShortcut="n" />
<item
android:id="@+id/incognito_menu_id"
- android:title="@string/incognito_tab"
+ android:title="@string/new_incognito_tab"
android:icon="@drawable/ic_new_incognito_holo_dark" />
<item
android:id="@+id/bookmarks_menu_id"
android:title="@string/bookmarks"
- android:icon="@drawable/ic_bookmarks_history_holo_dark" />
+ android:icon="@drawable/ic_bookmarks_history_holo_dark"
+ android:alphabeticShortcut="b"
+ android:visible="@bool/menu_show_bookmarks" />
<item
android:id="@+id/add_bookmark_menu_id"
android:title="@string/save_to_bookmarks"
android:icon="@drawable/ic_bookmark_on_holo_dark"
- android:alphabeticShortcut="d" />
+ android:alphabeticShortcut="d"
+ android:visible="@bool/menu_show_bookmarks" />
<item
android:id="@+id/find_menu_id"
android:title="@*android:string/find_on_page"
diff --git a/res/values-sw600dp/bools.xml b/res/values-sw600dp/bools.xml
index 3218656..50f87a7 100644
--- a/res/values-sw600dp/bools.xml
+++ b/res/values-sw600dp/bools.xml
@@ -13,4 +13,7 @@
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<bool name="isTablet">true</bool>
+ <!-- Browser menu toggles -->
+ <bool name="menu_show_navigation">false</bool>
+ <bool name="menu_show_bookmarks">false</bool>
</resources>
diff --git a/res/values-sw600dp/strings.xml b/res/values-sw600dp/strings.xml
deleted file mode 100644
index cb0d8a4..0000000
--- a/res/values-sw600dp/strings.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- Name of menu item of a new tab.
- Also used in the title bar when displaying a new tab [CHAR LIMIT=30] -->
- <string name="new_tab">New tab</string>
- <!-- Name of menu item of a new incognito tab. Also used in the
- title bar when displaying a new tab [CHAR LIMIT=30] -->
- <string name="new_incognito_tab">New incognito tab</string>
- <!-- Name of menu item which brings up a list of the currently active tabs -->
- <string name="active_tabs">Tabs</string>
- <!-- Context Menu item to open the currently selected link in a new
- window. [CHAR LIMIT=30] -->
- <string name="contextmenu_openlink_newwindow">Open in new tab</string>
- <!-- Context Menu item to open the currently selected link in a new
- background window. [CHAR LIMIT=50] -->
- <string name="contextmenu_openlink_newwindow_background">Open in new background tab</string>
- <!-- Context menu item to open every bookmark in a folder in new tabs [CHAR LIMIT=50] -->
- <string name="open_all_in_new_window">Open all in new tabs</string>
- <!-- Settings summary CHAR LIMIT=50]-->
- <string name="pref_content_open_in_background_summary">Open new tabs behind the current one</string>
- <!-- Recover tabs after a crash dialog title [CHAR LIMIT=32] -->
- <string name="recover_title">Restore tabs?</string>
- <!-- Recover tabs after a crash dialog prompt [CHAR LIMIT=none] -->
- <string name="recover_prompt">Would you like to restore your browser tabs from last time?</string>
-</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 55f8242..2cd26a8 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -14,4 +14,7 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<bool name="isTablet">false</bool>
<bool name="hide_nav_buttons">true</bool>
+ <!-- Browser menu toggles -->
+ <bool name="menu_show_navigation">true</bool>
+ <bool name="menu_show_bookmarks">true</bool>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87e77fc..5b1edb9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -22,10 +22,10 @@
system can provide a file [CHAR-LIMIT=NONE]-->
<string name="uploads_disabled">File uploads are disabled.</string>
<!-- Name of menu item of a new tab. Also used in the title bar when displaying a new tab -->
- <string name="new_tab">New window</string>
+ <string name="new_tab">New tab</string>
<!-- Name of menu item of a new incognito tab. Also used in the
title bar when displaying a new tab [CHAR LIMIT=30] -->
- <string name="new_incognito_tab">New incognito window</string>
+ <string name="new_incognito_tab">New incognito tab</string>
<!-- Name of tab containing bookmarks -->
<string name="tab_bookmarks">Bookmarks</string>
<!-- Name of tab containing the user's most visited websites, organized by number of visits -->
@@ -193,20 +193,12 @@
<!-- Confirmation dialog message confirming that the user wishes to delete
the bookmark they selected for deletion -->
<string name="delete_bookmark_warning">Bookmark \"<xliff:g id="bookmark">%s</xliff:g>\" will be deleted.</string>
- <!-- Context menu item to open every bookmark in a folder in new windows [CHAR LIMIT=50] -->
- <string name="open_all_in_new_window">Open all in new windows</string>
+ <!-- Context menu item to open every bookmark in a folder in new tabs [CHAR LIMIT=50] -->
+ <string name="open_all_in_new_window">Open all in new tabs</string>
<!-- Menu item to open a dialog which allows the user to enter a url or do search-->
<string name="goto_dot">Go</string>
- <!-- Menu item that opens up a new tab. [CHAR LIMIT=30] -->
- <string name="menu_new_tab">Open new tab</string>
- <!-- Menu item that opens up a new incognito tab. [CHAR LIMIT=30] -->
- <string name="incognito_tab">Open new incognito tab</string>
<!-- Menu item to switch to text selection mode for copy and paste. -->
<string name="select_dot">Select text</string>
- <!-- Title of current windows screen; appears in title bar -->
- <string name="tab_picker_title">Current windows</string>
- <!-- Context Menu item to close the currently selected window -->
- <string name="tab_picker_remove_tab">Close</string>
<!-- Menu item to open the bookmarks page. This is a shorter version that
is displayed with an icon -->
<string name="bookmarks">Bookmarks</string>
@@ -234,10 +226,10 @@
<string name="contextmenu_openlink">Open</string>
<!-- Context Menu item to open the currently selected link in a new
window. -->
- <string name="contextmenu_openlink_newwindow">Open in new window</string>
+ <string name="contextmenu_openlink_newwindow">Open in new tab</string>
<!-- Context Menu item to open the currently selected link in a new
background window. [CHAR LIMIT=50] -->
- <string name="contextmenu_openlink_newwindow_background">Open in new background window</string>
+ <string name="contextmenu_openlink_newwindow_background">Open in new background tab</string>
<!-- Context Menu item to save the webpage referred to by this link to the
SD card (external storage) -->
<string name="contextmenu_savelink">Save link</string>
@@ -314,7 +306,7 @@
<item>OFF</item>
</string-array>
<!-- Settings summary [CHAR LIMIT=50]-->
- <string name="pref_content_open_in_background_summary">Open new windows behind the current one</string>
+ <string name="pref_content_open_in_background_summary">Open new tabs behind the current one</string>
<!-- Settings label [CHAR LIMIT=50] -->
<string name="pref_content_homepage">Set homepage</string>
<!-- Settings label -->
@@ -724,10 +716,10 @@
<!-- Title for a dialog informing the user that they cannot open any more
windows because the limit has been reached. -->
- <string name="too_many_windows_dialog_title">Window limit reached</string>
+ <string name="too_many_windows_dialog_title">Tab limit reached</string>
<!-- Message in a dialog telling the user that they cannot open any more
windows because the limit has been reached. -->
- <string name="too_many_windows_dialog_message">Could not open a new window because you have already opened the maximum number.</string>
+ <string name="too_many_windows_dialog_message">Could not open a new tab because you have already opened the maximum number.</string>
<!-- Title for a dialog informing the user that they cannot open a subwindow
because only one can be open at a time. -->
<string name="too_many_subwindows_dialog_title">Pop-up already open</string>
diff --git a/src/com/android/browser/PreloadRequestReceiver.java b/src/com/android/browser/PreloadRequestReceiver.java
index 5176176..ff3c8e3 100644
--- a/src/com/android/browser/PreloadRequestReceiver.java
+++ b/src/com/android/browser/PreloadRequestReceiver.java
@@ -39,6 +39,7 @@
private static final String ACTION_PRELOAD = "android.intent.action.PRELOAD";
static final String EXTRA_PRELOAD_ID = "preload_id";
static final String EXTRA_PRELOAD_DISCARD = "preload_discard";
+ static final String EXTRA_SEARCHBOX_CANCEL = "searchbox_cancel";
static final String EXTRA_SEARCHBOX_SETQUERY = "searchbox_query";
@Override
@@ -61,6 +62,9 @@
if (i.getBooleanExtra(EXTRA_PRELOAD_DISCARD, false)) {
if (LOGD_ENABLED) Log.d(LOGTAG, "Got " + id + " preload discard request");
Preloader.getInstance().discardPreload(id);
+ } else if (i.getBooleanExtra(EXTRA_SEARCHBOX_CANCEL, false)) {
+ if (LOGD_ENABLED) Log.d(LOGTAG, "Got " + id + " searchbox cancel request");
+ Preloader.getInstance().cancelSearchBoxPreload(id);
} else {
if (LOGD_ENABLED) Log.d(LOGTAG, "Got " + id + " preload request for " + url);
if (url != null && url.startsWith("http")) {
diff --git a/src/com/android/browser/PreloadedTabControl.java b/src/com/android/browser/PreloadedTabControl.java
index 824c00b..ed066f2 100644
--- a/src/com/android/browser/PreloadedTabControl.java
+++ b/src/com/android/browser/PreloadedTabControl.java
@@ -89,6 +89,19 @@
return true;
}
+ public void searchBoxCancel() {
+ SearchBox sb = mTab.getWebView().getSearchBox();
+ if (sb != null) {
+ mLastQuery = null;
+ sb.oncancel(new SearchBox.SearchBoxListener(){
+ @Override
+ public void onCancelComplete(boolean called) {
+ if (LOGD_ENABLED) Log.d(LOGTAG, "Query cancelled: " + called);
+ }
+ });
+ }
+ }
+
public void loadUrlIfChanged(String url, Map<String, String> headers) {
String currentUrl = mTab.getUrl();
if (!TextUtils.isEmpty(currentUrl)) {
diff --git a/src/com/android/browser/Preloader.java b/src/com/android/browser/Preloader.java
index 3d30c96..3273a8c 100644
--- a/src/com/android/browser/Preloader.java
+++ b/src/com/android/browser/Preloader.java
@@ -106,6 +106,15 @@
}
}
+ public void cancelSearchBoxPreload(String id) {
+ PreloaderSession s = getSession(id);
+ if (s != null) {
+ s.touch(); // reset timer
+ PreloadedTabControl tab = s.getTabControl();
+ tab.searchBoxCancel();
+ }
+ }
+
public void discardPreload(String id) {
PreloaderSession s = takeSession(id);
if (s != null) {
diff --git a/src/com/android/browser/search/.DefaultSearchEngine.java.swp b/src/com/android/browser/search/.DefaultSearchEngine.java.swp
deleted file mode 100644
index 441153c..0000000
--- a/src/com/android/browser/search/.DefaultSearchEngine.java.swp
+++ /dev/null
Binary files differ
diff --git a/src/com/android/browser/search/DefaultSearchEngine.java b/src/com/android/browser/search/DefaultSearchEngine.java
index 0a7afcf..a575404 100644
--- a/src/com/android/browser/search/DefaultSearchEngine.java
+++ b/src/com/android/browser/search/DefaultSearchEngine.java
@@ -15,6 +15,7 @@
*/
package com.android.browser.search;
+import android.app.PendingIntent;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.ActivityNotFoundException;
@@ -92,6 +93,12 @@
intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData);
}
intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
+ Intent viewIntent = new Intent(Intent.ACTION_VIEW);
+ viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ viewIntent.setPackage(context.getPackageName());
+ PendingIntent pending = PendingIntent.getActivity(context, 0, viewIntent,
+ PendingIntent.FLAG_ONE_SHOT);
+ intent.putExtra(SearchManager.EXTRA_WEB_SEARCH_PENDINGINTENT, pending);
context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.e(TAG, "Web search activity not found: " + mSearchable.getSearchActivity());