summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorMathew Inwood <mathewi@google.com>2011-06-29 17:55:24 +0100
committerMathew Inwood <mathewi@google.com>2011-07-07 11:20:01 +0100
commit29721c2c6cc7f79a52962556c4431b71bb3ce46e (patch)
treecb1aa1f9619328449049a3acfa57e693895bc13f /src/com/android/browser/Controller.java
parent0a1ef7f86dc838eb324764faaec49acd38c5d9c8 (diff)
downloadpackages_apps_browser-29721c2c6cc7f79a52962556c4431b71bb3ce46e.zip
packages_apps_browser-29721c2c6cc7f79a52962556c4431b71bb3ce46e.tar.gz
packages_apps_browser-29721c2c6cc7f79a52962556c4431b71bb3ce46e.tar.bz2
Add SearchBox support to preloader.
Depends on change: I0119243ed0e19e237c1f51de887af5c954f96693 Change-Id: I2a2d3ff3c9d0d79f34af4c8daee828fb4efd7519
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 2e66c84..7343f32 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -67,6 +67,7 @@ import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.HttpAuthHandler;
+import android.webkit.SearchBox;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
@@ -2182,23 +2183,37 @@ public class Controller
}
}
+ private Tab showPreloadedTab(final UrlData urlData) {
+ if (!urlData.isPreloaded()) {
+ return null;
+ }
+ final PreloadedTabControl tabControl = urlData.getPreloadedTab();
+ final String sbQuery = urlData.getSearchBoxQueryToSubmit();
+ if (sbQuery != null) {
+ if (!tabControl.searchBoxSubmit(sbQuery, urlData.mUrl, urlData.mHeaders)) {
+ // Could not submit query. Fallback to regular tab creation
+ tabControl.destroy();
+ return null;
+ }
+ }
+ Tab t = tabControl.getTab();
+ mTabControl.addPreloadedTab(t);
+ addTab(t);
+ setActiveTab(t);
+ return t;
+ }
+
// open a non inconito tab with the given url data
// and set as active tab
public Tab openTab(UrlData urlData) {
- if (urlData.isPreloaded()) {
- Tab tab = urlData.getPreloadedTab();
- tab.getWebView().clearHistory();
- mTabControl.addPreloadedTab(tab);
- addTab(tab);
- setActiveTab(tab);
- return tab;
- } else {
- Tab tab = createNewTab(false, true, true);
+ Tab tab = showPreloadedTab(urlData);
+ if (tab == null) {
+ tab = createNewTab(false, true, true);
if ((tab != null) && !urlData.isEmpty()) {
loadUrlDataIn(tab, urlData);
}
- return tab;
}
+ return tab;
}
@Override