Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java |
index 4ae81a1abcb31598b69cc13c93b9ac314ab86dbf..c262be9c406e760ae727231309fedfd8bde09e60 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java |
@@ -390,8 +390,23 @@ public class CustomTabActivity extends ChromeActivity { |
} |
@Override |
+ public boolean onKeyDown(int keyCode, KeyEvent event) { |
+ if (!getToolbarManager().isInitialized()) { |
+ return super.onKeyDown(keyCode, event); |
+ } |
+ return KeyboardShortcuts.onKeyDown(event, this, true, false) |
+ || super.onKeyDown(keyCode, event); |
+ } |
+ |
+ @Override |
public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { |
- if (id == R.id.open_in_chrome_id) { |
+ // Disable creating new tabs, bookmark, history, print, help, focus_url, etc. |
+ if (id == R.id.focus_url_bar || id == R.id.all_bookmarks_menu_id |
+ || id == R.id.bookmark_this_page_id || id == R.id.print_id || id == R.id.help_id |
+ || id == R.id.recent_tabs_menu_id || id == R.id.new_incognito_tab_menu_id |
+ || id == R.id.new_tab_menu_id) { |
+ return true; |
+ } else if (id == R.id.open_in_chrome_id) { |
String url = getTabModelSelector().getCurrentTab().getUrl(); |
Intent chromeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
chromeIntent.setPackage(getApplicationContext().getPackageName()); |
@@ -410,9 +425,6 @@ public class CustomTabActivity extends ChromeActivity { |
RecordUserAction.record("MobileShortcutFindInPage"); |
} |
return true; |
- } else if (id == R.id.focus_url_bar) { |
- // Do nothing because url bar in custom tabs is not editable. |
- return true; |
} |
return super.onMenuOrKeyboardAction(id, fromMenu); |
} |