| Index: components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java
|
| diff --git a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java
|
| index babf91ea359650690a8f383ad2b63492deb3c29f..e52bd043bba7d4178854b0dc43d066c958d7cd99 100644
|
| --- a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java
|
| +++ b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java
|
| @@ -9,6 +9,7 @@ import android.content.Context;
|
| import org.chromium.base.CalledByNative;
|
| import org.chromium.base.JNINamespace;
|
| import org.chromium.content.browser.ContentViewCore;
|
| +import org.chromium.ui.ColorSuggestion;
|
| import org.chromium.ui.ColorPickerDialog;
|
| import org.chromium.ui.OnColorChangedListener;
|
|
|
| @@ -22,7 +23,7 @@ public class ColorChooserAndroid {
|
| private final int mNativeColorChooserAndroid;
|
|
|
| private ColorChooserAndroid(int nativeColorChooserAndroid,
|
| - Context context, int initialColor) {
|
| + Context context, int initialColor, ColorSuggestion[] suggestions) {
|
| OnColorChangedListener listener = new OnColorChangedListener() {
|
| @Override
|
| public void onColorChanged(int color) {
|
| @@ -32,7 +33,7 @@ public class ColorChooserAndroid {
|
| };
|
|
|
| mNativeColorChooserAndroid = nativeColorChooserAndroid;
|
| - mDialog = new ColorPickerDialog(context, listener, initialColor);
|
| + mDialog = new ColorPickerDialog(context, listener, initialColor, suggestions);
|
| }
|
|
|
| private void openColorChooser() {
|
| @@ -48,13 +49,31 @@ public class ColorChooserAndroid {
|
| public static ColorChooserAndroid createColorChooserAndroid(
|
| int nativeColorChooserAndroid,
|
| ContentViewCore contentViewCore,
|
| - int initialColor) {
|
| + int initialColor,
|
| + ColorSuggestion[] suggestions) {
|
| ColorChooserAndroid chooser = new ColorChooserAndroid(nativeColorChooserAndroid,
|
| - contentViewCore.getContext(), initialColor);
|
| + contentViewCore.getContext(), initialColor, suggestions);
|
| chooser.openColorChooser();
|
| return chooser;
|
| }
|
|
|
| + @CalledByNative
|
| + private static ColorSuggestion[] createColorSuggestionArray(int size) {
|
| + return new ColorSuggestion[size];
|
| + }
|
| +
|
| + /**
|
| + * @param array ColorSuggestion array that should get a new suggestion added.
|
| + * @param index Index in the array where to place a new suggestion.
|
| + * @param color Color of the suggestion.
|
| + * @param label Label of the suggestion.
|
| + */
|
| + @CalledByNative
|
| + private static void addToColorSuggestionArray(ColorSuggestion[] array, int index,
|
| + int color, String label) {
|
| + array[index] = new ColorSuggestion(color, label);
|
| + }
|
| +
|
| // Implemented in color_chooser_android.cc
|
| private native void nativeOnColorChosen(int nativeColorChooserAndroid, int color);
|
| }
|
|
|