| Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
|
| index 0b85cc770f3fa9478e2421502ce868c627b15015..83bca9e3bcaa84aef9246791eaa1418350987b5f 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
|
| @@ -7,6 +7,7 @@ package org.chromium.chrome.browser.infobar;
|
| import android.content.Context;
|
| import android.content.res.Resources;
|
| import android.graphics.Paint;
|
| +import android.support.annotation.Nullable;
|
| import android.support.v7.widget.SwitchCompat;
|
| import android.text.method.LinkMovementMethod;
|
| import android.view.LayoutInflater;
|
| @@ -44,11 +45,16 @@ import java.util.List;
|
| * TODO(dfalcantara): The line spacing multiplier is applied to all lines in JB & KK, even if the
|
| * TextView has only one line. This throws off vertical alignment. Find a
|
| * solution that hopefully doesn't involve subclassing the TextView.
|
| + *
|
| + * TODO(dfalcantara): Move this to a more general location.
|
| */
|
| public final class InfoBarControlLayout extends ViewGroup {
|
| + public static final int INVALID_INDEX = -1;
|
| +
|
| /**
|
| * ArrayAdapter that automatically determines what size make its Views to accommodate all of
|
| * its potential values.
|
| + * @param <T> Type of object that the ArrayAdapter stores.
|
| */
|
| public static final class InfoBarArrayAdapter<T> extends ArrayAdapter<T> {
|
| private final String mLabel;
|
| @@ -361,9 +367,11 @@ public final class InfoBarControlLayout extends ViewGroup {
|
| * -------------------------------------------------
|
| *
|
| * @param messages Messages to display for the options.
|
| + * @param tags Optional list of tags to attach to the buttons.
|
| * @param selectedIndex Which index to mark as being selected.
|
| */
|
| - public RadioGroup addRadioButtons(List<CharSequence> messages, int selectedIndex) {
|
| + public RadioGroup addRadioButtons(
|
| + List<CharSequence> messages, @Nullable List<?> tags, int selectedIndex) {
|
| ControlLayoutParams params = new ControlLayoutParams();
|
| params.mMustBeFullWidth = true;
|
|
|
| @@ -375,6 +383,7 @@ public final class InfoBarControlLayout extends ViewGroup {
|
| (RadioButton) LayoutInflater.from(getContext())
|
| .inflate(R.layout.infobar_control_radio, radioLayout, false);
|
| button.setText(messages.get(i));
|
| + if (tags != null) button.setTag(tags.get(i));
|
| button.setChecked(i == selectedIndex);
|
| radioLayout.addView(button);
|
|
|
|
|