summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-02-16 15:19:47 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-16 15:19:47 -0800
commit3029ab4026e4d00f34ad65d9d7c467afa9a4df51 (patch)
treec12681ef1b04abfdcb97701e5abb02b401bd9d12 /src/com/android/browser/Controller.java
parent10790a466981b50690e6f03fb9f7c4ef6a7a5eb9 (diff)
parentdc2ee1bfb50b7bec0cf3215e3d298b246dc71101 (diff)
downloadpackages_apps_Browser-3029ab4026e4d00f34ad65d9d7c467afa9a4df51.zip
packages_apps_Browser-3029ab4026e4d00f34ad65d9d7c467afa9a4df51.tar.gz
packages_apps_Browser-3029ab4026e4d00f34ad65d9d7c467afa9a4df51.tar.bz2
Merge "fix shortcut handling"
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 80da85f..6393ac8 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1026,9 +1026,7 @@ public class Controller
// callback from phone title bar
public void editUrl() {
if (mOptionsMenuOpen) mActivity.closeOptionsMenu();
- String url = (getCurrentTopWebView() == null) ? null : getCurrentTopWebView().getUrl();
- startSearch(mSettings.getHomePage().equals(url) ? null : url, true,
- null, false);
+ mUi.editUrl(false);
}
public void startVoiceSearch() {
@@ -2412,6 +2410,12 @@ public class Controller
startSearch(result, false, bundle, false);
}
+ @Override
+ public void startSearch(String url) {
+ startSearch(mSettings.getHomePage().equals(url) ? null : url, true,
+ null, false);
+ }
+
private void startSearch(String initialQuery, boolean selectInitialQuery,
Bundle appSearchData, boolean globalSearch) {
if (appSearchData == null) {
@@ -2445,14 +2449,13 @@ public class Controller
// Even if MENU is already held down, we need to call to super to open
// the IME on long press.
- if (!noModifiers && KeyEvent.KEYCODE_MENU == keyCode) {
+ if (!noModifiers
+ && ((KeyEvent.KEYCODE_MENU == keyCode)
+ || (KeyEvent.KEYCODE_CTRL_LEFT == keyCode)
+ || (KeyEvent.KEYCODE_CTRL_RIGHT == keyCode))) {
mMenuIsDown = true;
return false;
}
- // The default key mode is DEFAULT_KEYS_SEARCH_LOCAL. As the MENU is
- // still down, we don't want to trigger the search. Pretend to consume
- // the key and do nothing.
- if (mMenuIsDown) return true;
WebView webView = getCurrentTopWebView();
if (webView == null) return false;
@@ -2525,10 +2528,12 @@ public class Controller
// case KeyEvent.KEYCODE_O: // in Chrome: open file
// case KeyEvent.KEYCODE_P: // in Chrome: print page
// case KeyEvent.KEYCODE_Q: // unused
-// case KeyEvent.KEYCODE_R:
+// case KeyEvent.KEYCODE_R:
// case KeyEvent.KEYCODE_S: // in Chrome: saves page
case KeyEvent.KEYCODE_T:
- if (ctrl) {
+ // we can't use the ctrl/shift flags, they check for
+ // exclusive use of a modifier
+ if (event.isCtrlPressed()) {
if (event.isShiftPressed()) {
openIncognitoTab();
} else {
@@ -2544,8 +2549,8 @@ public class Controller
// case KeyEvent.KEYCODE_Y: // unused
// case KeyEvent.KEYCODE_Z: // unused
}
- // if we get here, it is a regular key and webview is not null
- return mUi.dispatchKey(keyCode, event);
+ // it is a regular key and webview is not null
+ return mUi.dispatchKey(keyCode, event);
}
boolean onKeyUp(int keyCode, KeyEvent event) {