summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-03-03 16:40:58 -0500
committerLeon Scroggins <scroggo@google.com>2010-03-03 16:40:58 -0500
commit0c75a8ed8d95d2f5278826222ca5ec4e96b2aee4 (patch)
tree18871c2a688b1ad2789c14ed2ce1adc4f96554dd /src
parent4324bcda7faedf487eb3f461657c9cba667799f1 (diff)
downloadpackages_apps_Browser-0c75a8ed8d95d2f5278826222ca5ec4e96b2aee4.tar.gz
packages_apps_Browser-0c75a8ed8d95d2f5278826222ca5ec4e96b2aee4.tar.bz2
packages_apps_Browser-0c75a8ed8d95d2f5278826222ca5ec4e96b2aee4.zip
Going back to a voice search will reenter voice search mode.
Store the Intent that initiated voice search mode in the history item, so that when going back to that page, we can reinvoke voice search with all of the intended extras. Fix for http://b/issue?id=2425052
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/Tab.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index a31326910..7e03bbcec 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -55,6 +55,7 @@ import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.ValueCallback;
import android.webkit.WebBackForwardList;
+import android.webkit.WebBackForwardListClient;
import android.webkit.WebChromeClient;
import android.webkit.WebHistoryItem;
import android.webkit.WebIconDatabase;
@@ -127,6 +128,8 @@ class Tab {
// The listener that gets invoked when a download is started from the
// mMainView
private final DownloadListener mDownloadListener;
+ // Listener used to know when we move forward or back in the history list.
+ private final WebBackForwardListClient mWebBackForwardListClient;
// AsyncTask for downloading touch icons
DownloadTouchIcon mTouchIconLoader;
@@ -241,6 +244,7 @@ class Tab {
}
}
}
+ mVoiceSearchData.mVoiceSearchIntent = intent;
mVoiceSearchData.mLastVoiceSearchTitle
= mVoiceSearchData.mVoiceSearchResults.get(index);
if (mInForeground) {
@@ -323,6 +327,12 @@ class Tab {
*/
public boolean mSourceIsGoogle;
/**
+ * The Intent used to invoke voice search. Placed on the
+ * WebHistoryItem so that when coming back to a previous voice search
+ * page we can again activate voice search.
+ */
+ public Object mVoiceSearchIntent;
+ /**
* String used to identify Google as the source of voice search.
*/
public static String SOURCE_IS_GOOGLE
@@ -1270,6 +1280,21 @@ class Tab {
}
}
};
+ mWebBackForwardListClient = new WebBackForwardListClient() {
+ @Override
+ public void onNewHistoryItem(WebHistoryItem item) {
+ if (isInVoiceSearchMode()) {
+ item.setCustomData(mVoiceSearchData.mVoiceSearchIntent);
+ }
+ }
+ @Override
+ public void onIndexChanged(WebHistoryItem item, int index) {
+ Object data = item.getCustomData();
+ if (data != null && data instanceof Intent) {
+ activateVoiceSearchMode((Intent) data);
+ }
+ }
+ };
setWebView(w);
}
@@ -1302,6 +1327,7 @@ class Tab {
// does a redirect after a period of time. The user could have
// switched to another tab while waiting for the download to start.
mMainView.setDownloadListener(mDownloadListener);
+ mMainView.setWebBackForwardListClient(mWebBackForwardListClient);
}
}