Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4460)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 1365453004: Create a new custom class that handles keyboard shortcuts for Custom Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698