more hw keyboard fixes

     Bug: 3270434
     added Ctrl-Tab/ Shft-Ctrl-Tab to navigate next/prev tab

Change-Id: I9c874cbe2f23c9916044a2ffd8b9e82e510f21ac
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 82aea47..80cc7ca 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2459,6 +2459,23 @@
     }
 
     /**
+     * helper method for key handler
+     * returns the current tab if it can't advance
+     */
+    private int getNextTabIndex() {
+        return Math.min(mTabControl.getTabCount() - 1,
+                mTabControl.getCurrentIndex() + 1);
+    }
+
+    /**
+     * helper method for key handler
+     * returns the current tab if it can't advance
+     */
+    private int getPrevTabIndex() {
+        return  Math.max(0, mTabControl.getCurrentIndex() - 1);
+    }
+
+    /**
      * handle key events in browser
      *
      * @param keyCode
@@ -2485,6 +2502,18 @@
         boolean shift = event.hasModifiers(KeyEvent.META_SHIFT_ON);
 
         switch(keyCode) {
+            case KeyEvent.KEYCODE_TAB:
+                if (event.isCtrlPressed()) {
+                    if (event.isShiftPressed()) {
+                        // prev tab
+                        switchToTab(getPrevTabIndex());
+                    } else {
+                        // next tab
+                        switchToTab(getNextTabIndex());
+                    }
+                    return true;
+                }
+                break;
             case KeyEvent.KEYCODE_ESCAPE:
                 if (!noModifiers) break;
                 stopLoading();