diff options
author | Russell Brenner <russellbrenner@google.com> | 2011-01-13 09:54:49 -0800 |
---|---|---|
committer | android-merger <android-merger@google.com> | 2011-01-13 15:45:35 -0800 |
commit | 2657ead3c0a5cc19bf180bc8e469517c9511ffe0 (patch) | |
tree | c3ee0136b6f3085556b9ff176250bd0fe7ad2be3 | |
parent | a7da4d71d96405905dd036a03b50a4b1626e39e4 (diff) | |
download | packages_apps_Browser-2657ead3c0a5cc19bf180bc8e469517c9511ffe0.zip packages_apps_Browser-2657ead3c0a5cc19bf180bc8e469517c9511ffe0.tar.gz packages_apps_Browser-2657ead3c0a5cc19bf180bc8e469517c9511ffe0.tar.bz2 |
Merge "Fix 3337625 to follow link to Google Images" into honeycomb
-rw-r--r-- | src/com/android/browser/UrlHandler.java | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java index cd0afeb..f39ac4b 100644 --- a/src/com/android/browser/UrlHandler.java +++ b/src/com/android/browser/UrlHandler.java @@ -120,7 +120,7 @@ public class UrlHandler { // AsyncTask. Although we are not overriding the URL load synchronously, // we guarantee that we will handle this URL load after the task executes, // so it's safe to just return true to WebCore now to stop its own loading. - new RLZTask(siteUri, view).execute(); + new RLZTask(tab, siteUri, view).execute(); return true; } } @@ -137,9 +137,7 @@ public class UrlHandler { return true; } - if (mController.isMenuDown()) { - mController.openTab(tab, url, false); - mActivity.closeOptionsMenu(); + if (handleMenuClick(tab, url)) { return true; } @@ -198,6 +196,19 @@ public class UrlHandler { return false; } + // In case a physical keyboard is attached, handle clicks with the menu key + // depressed by opening in a new tab + boolean handleMenuClick(Tab tab, String url) + { + if (mController.isMenuDown()) { + mController.openTab(tab, url, false); + mActivity.closeOptionsMenu(); + return true; + } + + return false; + } + // Url for issuing the uber token. private final static Uri ISSUE_AUTH_TOKEN_URL = Uri.parse( "https://www.google.com/accounts/IssueAuthToken?service=gaia&Session=false"); @@ -355,10 +366,12 @@ public class UrlHandler { } private class RLZTask extends AsyncTask<Void, Void, String> { + private Tab mTab; private Uri mSiteUri; private WebView mWebView; - public RLZTask(Uri uri, WebView webView) { + public RLZTask(Tab tab, Uri uri, WebView webView) { + mTab = tab; mSiteUri = uri; mWebView = webView; } @@ -383,7 +396,12 @@ public class UrlHandler { } protected void onPostExecute(String result) { - startActivityForUrl(result); + // If the Activity Manager is not invoked, load the URL directly + if (!startActivityForUrl(result)) { + if (!handleMenuClick(mTab, result)) { + mController.loadUrl(mWebView, result); + } + } } } |