Bug 1450076 - Add more keyboard shortcuts for opening new tabs. r=jchen
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 29 Mar 2018 21:05:47 +0200
changeset 411550 b2101216ff5e7230cc3cba8846308b5f5b08d023
parent 411549 7cd56bc0b98569426a0e485443654c520f5cbdd3
child 411551 90728fcb1b4c5a83d49a9f2358c07b93f9d92d71
push id101686
push useraciure@mozilla.com
push dateTue, 03 Apr 2018 21:59:31 +0000
treeherdermozilla-inbound@8d846598d35d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1450076
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1450076 - Add more keyboard shortcuts for opening new tabs. r=jchen We cannot open completely new windows on mobile, but we sort of mimic desktop by having Ctrl + N/Ctrl + Shift + P always open a new normal/private tab, whereas for Ctrl + T the kind of tab opened will now depend on the currently selected tab. MozReview-Commit-ID: KmPCcnn79OH
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -637,19 +637,33 @@ public class BrowserApp extends GeckoApp
                     return true;
 
                 case KeyEvent.KEYCODE_PERIOD:
                     tab.doStop();
                     return true;
 
                 case KeyEvent.KEYCODE_T:
                     int flags = Tabs.LOADURL_START_EDITING;
+                    if (tab.isPrivate()) {
+                        flags |= Tabs.LOADURL_PRIVATE;
+                    }
                     addTab(flags);
                     return true;
 
+                case KeyEvent.KEYCODE_N:
+                    addTab(Tabs.LOADURL_START_EDITING);
+                    return true;
+
+                case KeyEvent.KEYCODE_P:
+                    if (event.isShiftPressed()) {
+                        addTab(Tabs.LOADURL_PRIVATE | Tabs.LOADURL_START_EDITING);
+                        return true;
+                    }
+                    break;
+
                 case KeyEvent.KEYCODE_W:
                     Tabs.getInstance().closeTab(tab);
                     return true;
 
                 case KeyEvent.KEYCODE_F:
                     mFindInPageBar.show(mBrowserToolbar.isPrivateMode());
                 return true;
             }