diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/browser/Controller.java | 18 | ||||
-rw-r--r-- | src/com/android/browser/DownloadHandler.java | 1 | ||||
-rw-r--r-- | src/com/android/browser/PhoneUi.java | 8 | ||||
-rw-r--r-- | src/com/android/browser/UiController.java | 2 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index e901d45..ebfd56f 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -1579,6 +1579,10 @@ public class Controller openIncognitoTab(); break; + case R.id.close_other_tabs_id: + closeOtherTabs(); + break; + case R.id.goto_menu_id: editUrl(); break; @@ -2511,6 +2515,20 @@ public class Controller } } + /** + * Close all tabs except the current one + */ + @Override + public void closeOtherTabs() { + int inactiveTabs = mTabControl.getTabCount() - 1; + for (int i = inactiveTabs; i >= 0; i--) { + Tab tab = mTabControl.getTab(i); + if (tab != mTabControl.getCurrentTab()) { + removeTab(tab); + } + } + } + // Called when loading from context menu or LOAD_URL message protected void loadUrlFromContext(String url) { Tab tab = getCurrentTab(); diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java index 6e2c786..31212b4 100644 --- a/src/com/android/browser/DownloadHandler.java +++ b/src/com/android/browser/DownloadHandler.java @@ -204,6 +204,7 @@ public class DownloadHandler { // old percent-encoded url. String cookies = CookieManager.getInstance().getCookie(url, privateBrowsing); request.addRequestHeader("cookie", cookies); + request.addRequestHeader("User-Agent", userAgent); request.setNotificationVisibility( DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); if (mimetype == null) { diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java index eb6032d..e3c22bd 100644 --- a/src/com/android/browser/PhoneUi.java +++ b/src/com/android/browser/PhoneUi.java @@ -182,6 +182,14 @@ public class PhoneUi extends BaseUi { if (incognito != null) { incognito.setVisible(showingNavScreen() || mUseQuickControls); } + MenuItem closeOthers = menu.findItem(R.id.close_other_tabs_id); + if (closeOthers != null) { + boolean isLastTab = true; + if (tab != null) { + isLastTab = (mTabControl.getTabCount() <= 1); + } + closeOthers.setEnabled(!isLastTab); + } if (showingNavScreen()) { menu.setGroupVisible(R.id.LIVE_MENU, false); menu.setGroupVisible(R.id.SNAPSHOT_MENU, false); diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java index d5dfa3e..683e473 100644 --- a/src/com/android/browser/UiController.java +++ b/src/com/android/browser/UiController.java @@ -59,6 +59,8 @@ public interface UiController { void closeTab(Tab tab); + void closeOtherTabs(); + void stopLoading(); Intent createBookmarkCurrentPageIntent(boolean canBeAnEdit); |