diff options
Diffstat (limited to 'src/com/android/browser/IntentHandler.java')
-rw-r--r-- | src/com/android/browser/IntentHandler.java | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java index b556638..8d1b784 100644 --- a/src/com/android/browser/IntentHandler.java +++ b/src/com/android/browser/IntentHandler.java @@ -134,7 +134,7 @@ public class IntentHandler { } if (intent.getBooleanExtra(Browser.EXTRA_CREATE_NEW_TAB, false)) { - mController.openTabAndShow(mTabControl.getCurrentTab(), urlData, false, null); + mController.openTab(urlData); return; } final String appId = intent @@ -146,12 +146,15 @@ public class IntentHandler { && !mActivity.getPackageName().equals(appId) && (flags & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { if (activateVoiceSearch) { - Tab appTab = mTabControl.getTabFromId(appId); + Tab appTab = mTabControl.getTabFromAppId(appId); if (appTab != null) { mController.reuseTab(appTab, appId, urlData); return; } else { - mController.openTabAndShow(null, urlData, false, appId); + Tab tab = mController.openTab(urlData); + if (tab != null) { + tab.setAppId(appId); + } } } else { // No matching application tab, try to find a regular tab @@ -159,7 +162,7 @@ public class IntentHandler { Tab appTab = mTabControl.findUnusedTabWithUrl(urlData.mUrl); if (appTab != null) { if (current != appTab) { - mController.switchToTab(mTabControl.getTabIndex(appTab)); + mController.switchToTab(appTab); } // Otherwise, we are already viewing the correct tab. } else { @@ -168,7 +171,10 @@ public class IntentHandler { // MAX_TABS. Then the url will be opened in the current // tab. If a new tab is created, it will have "true" for // exit on close. - mController.openTabAndShow(null, urlData, false, appId); + Tab tab = mController.openTab(urlData); + if (tab != null) { + tab.setAppId(appId); + } } } } else { @@ -187,7 +193,7 @@ public class IntentHandler { } else if ("about:debug.nav".equals(urlData.mUrl)) { current.getWebView().debugDump(); } else { - mSettings.toggleDebugSettings(mActivity); + mSettings.toggleDebugSettings(); } return; } @@ -221,17 +227,6 @@ public class IntentHandler { headers.put(key, pairs.getString(key)); } } - - // AppId will be set to the Browser for Search Bar initiated searches - final String appId = intent.getStringExtra(Browser.EXTRA_APPLICATION_ID); - if (mActivity.getPackageName().equals(appId)) { - String rlz = mSettings.getRlzValue(); - Uri uri = Uri.parse(url); - if (!rlz.isEmpty() && needsRlz(uri)) { - Uri rlzUri = addRlzParameter(uri, rlz); - url = rlzUri.toString(); - } - } } } else if (Intent.ACTION_SEARCH.equals(action) || MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action) @@ -375,19 +370,4 @@ public class IntentHandler { } } - private static boolean needsRlz(Uri uri) { - if ((uri.getQueryParameter("rlz") == null) && - (uri.getQueryParameter("q") != null) && - UrlUtils.isGoogleUri(uri)) { - return true; - } - return false; - } - - private static Uri addRlzParameter(Uri uri, String rlz) { - if (rlz.isEmpty()) { - return uri; - } - return uri.buildUpon().appendQueryParameter("rlz", rlz).build(); - } } |