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

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

Issue 1329733003: Limit the number of custom menu items to 5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed Math.min is test 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 | chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java » ('j') | 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/CustomTabIntentDataProvider.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
index ee99a093ffefff274fccb4fd45b70436d90b5e1c..c98aa5d54fff1335120e9e39550ca3e5a7182f97 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
@@ -72,6 +72,7 @@ public class CustomTabIntentDataProvider {
public static final String EXTRA_TINT_ACTION_BUTTON =
"android.support.customtabs.extra.TINT_ACTION_BUTTON";
+ private static final int MAX_CUSTOM_MENU_ITEMS = 5;
private static final String BUNDLE_PACKAGE_NAME = "android:packageName";
private static final String BUNDLE_ENTER_ANIMATION_RESOURCE = "android:animEnterRes";
private static final String BUNDLE_EXIT_ANIMATION_RESOURCE = "android:animExitRes";
@@ -140,7 +141,8 @@ public class CustomTabIntentDataProvider {
List<Bundle> menuItems =
IntentUtils.getParcelableArrayListExtra(intent, CustomTabsIntent.EXTRA_MENU_ITEMS);
if (menuItems != null) {
- for (Bundle bundle : menuItems) {
+ for (int i = 0; i < Math.min(MAX_CUSTOM_MENU_ITEMS, menuItems.size()); i++) {
+ Bundle bundle = menuItems.get(i);
String title =
IntentUtils.safeGetString(bundle, CustomTabsIntent.KEY_MENU_ITEM_TITLE);
PendingIntent pendingIntent =
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698