Chromium Code Reviews| 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..44e9bb275f40206706a646de658c407e91a5dbe3 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,32 @@ 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 AutofillSuggestion array that should get a new suggestion added. |
| + * @param index Index in the array where to place a new suggestion. |
| + * @param name Name of the suggestion. |
|
newt (away)
2013/08/26 20:23:20
these params need updating
keishi
2013/08/29 03:40:47
Done.
|
| + * @param label Label of the suggestion. |
| + * @param uniqueId Unique suggestion id. |
| + */ |
| + @CalledByNative |
| + private static void addToColorSuggestionArray(ColorSuggestion[] array, int index, |
| + int valueAsColor, String displayString, String label) { |
| + array[index] = new ColorSuggestion(valueAsColor, displayString, label); |
| + } |
| + |
| // Implemented in color_chooser_android.cc |
| private native void nativeOnColorChosen(int nativeColorChooserAndroid, int color); |
| } |