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

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

Issue 1342343002: Make menu hardware key work on Custom Tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | 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 6519f4afa973287015d4a536f4ce83cb52041bee..2fc5341f16b7254d6f6baeba500c5d99eded6178 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
@@ -10,6 +10,7 @@ import android.os.IBinder;
import android.support.customtabs.CustomTabsCallback;
import android.support.customtabs.CustomTabsIntent;
import android.text.TextUtils;
+import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
@@ -25,6 +26,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.IntentHandler.ExternalAppId;
+import org.chromium.chrome.browser.KeyboardShortcuts;
import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate;
import org.chromium.chrome.browser.appmenu.ChromeAppMenuPropertiesDelegate;
import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel.StateChangeReason;
@@ -340,6 +342,13 @@ public class CustomTabActivity extends ChromeActivity {
}
@Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this,
+ getToolbarManager().isInitialized());
+ return result != null ? result : super.dispatchKeyEvent(event);
+ }
+
+ @Override
public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) {
if (id == R.id.show_menu) {
if (shouldShowAppMenu()) {
@@ -365,6 +374,9 @@ 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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698