diff options
Diffstat (limited to 'src/com/android/browser')
| -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 cd0afeb3c..f39ac4b6b 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); + } + } } } |
