// If the WebView has the same original url and is on that
// page, it can be reused.
boolean needsLoad =
- mTabControl.recreateWebView(appTab, urlData.mUrl)
- // If there is a voice intent in the UrlData, then
- // recreateWebView may return false, but we still
- // need to force a load.
- || urlData.mVoiceIntent != null;
+ mTabControl.recreateWebView(appTab, urlData);
if (current != appTab) {
switchToTab(mTabControl.getTabIndex(appTab));
* A UrlData class to abstract how the content will be set to WebView.
* This base class uses loadUrl to show the content.
*/
- private static class UrlData {
+ /* package */ static class UrlData {
final String mUrl;
final Map<String, String> mHeaders;
final Intent mVoiceIntent;
/**
* Recreate the main WebView of the given tab. Returns true if the WebView
- * was deleted.
+ * requires a load, whether it was due to the fact that it was deleted, or
+ * it is because it was a voice search.
*/
- boolean recreateWebView(Tab t, String url) {
+ boolean recreateWebView(Tab t, BrowserActivity.UrlData urlData) {
+ final String url = urlData.mUrl;
final WebView w = t.getWebView();
if (w != null) {
+ if (urlData.mVoiceIntent != null) {
+ // In the case of a voice search, we do not want to destroy the
+ // back forward list, so that we can go back to the prior search
+ return true;
+ }
if (url != null && url.equals(t.getOriginalUrl())) {
// The original url matches the current url. Just go back to the
// first history item so we can load it faster than if we