OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.components.web_contents_delegate_android; | 5 package org.chromium.components.web_contents_delegate_android; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
10 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
11 import org.chromium.content.browser.ContentViewCore; | 11 import org.chromium.content_public.browser.WebContents; |
12 import org.chromium.ui.ColorPickerDialog; | 12 import org.chromium.ui.ColorPickerDialog; |
13 import org.chromium.ui.ColorSuggestion; | 13 import org.chromium.ui.ColorSuggestion; |
14 import org.chromium.ui.OnColorChangedListener; | 14 import org.chromium.ui.OnColorChangedListener; |
15 | 15 |
16 /** | 16 /** |
17 * ColorChooserAndroid communicates with the java ColorPickerDialog and the | 17 * ColorChooserAndroid communicates with the java ColorPickerDialog and the |
18 * native color_chooser_android.cc | 18 * native color_chooser_android.cc |
19 */ | 19 */ |
20 @JNINamespace("web_contents_delegate_android") | 20 @JNINamespace("web_contents_delegate_android") |
21 public class ColorChooserAndroid { | 21 public class ColorChooserAndroid { |
(...skipping 19 matching lines...) Expand all Loading... | |
41 } | 41 } |
42 | 42 |
43 @CalledByNative | 43 @CalledByNative |
44 public void closeColorChooser() { | 44 public void closeColorChooser() { |
45 mDialog.dismiss(); | 45 mDialog.dismiss(); |
46 } | 46 } |
47 | 47 |
48 @CalledByNative | 48 @CalledByNative |
49 public static ColorChooserAndroid createColorChooserAndroid( | 49 public static ColorChooserAndroid createColorChooserAndroid( |
50 long nativeColorChooserAndroid, | 50 long nativeColorChooserAndroid, |
51 ContentViewCore contentViewCore, | 51 WebContents webContents, |
52 int initialColor, | 52 int initialColor, |
53 ColorSuggestion[] suggestions) { | 53 ColorSuggestion[] suggestions) { |
54 ColorChooserAndroid chooser = new ColorChooserAndroid(nativeColorChooser Android, | 54 ColorChooserAndroid chooser = new ColorChooserAndroid(nativeColorChooser Android, |
55 contentViewCore.getContext(), initialColor, suggestions); | 55 webContents.getContext(), initialColor, suggestions); |
Yaron
2014/10/15 20:32:38
From a preliminary look, it appears that Applicati
AKVT
2014/10/29 18:13:28
Done. Thank you
| |
56 chooser.openColorChooser(); | 56 chooser.openColorChooser(); |
57 return chooser; | 57 return chooser; |
58 } | 58 } |
59 | 59 |
60 @CalledByNative | 60 @CalledByNative |
61 private static ColorSuggestion[] createColorSuggestionArray(int size) { | 61 private static ColorSuggestion[] createColorSuggestionArray(int size) { |
62 return new ColorSuggestion[size]; | 62 return new ColorSuggestion[size]; |
63 } | 63 } |
64 | 64 |
65 /** | 65 /** |
66 * @param array ColorSuggestion array that should get a new suggestion added . | 66 * @param array ColorSuggestion array that should get a new suggestion added . |
67 * @param index Index in the array where to place a new suggestion. | 67 * @param index Index in the array where to place a new suggestion. |
68 * @param color Color of the suggestion. | 68 * @param color Color of the suggestion. |
69 * @param label Label of the suggestion. | 69 * @param label Label of the suggestion. |
70 */ | 70 */ |
71 @CalledByNative | 71 @CalledByNative |
72 private static void addToColorSuggestionArray(ColorSuggestion[] array, int i ndex, | 72 private static void addToColorSuggestionArray(ColorSuggestion[] array, int i ndex, |
73 int color, String label) { | 73 int color, String label) { |
74 array[index] = new ColorSuggestion(color, label); | 74 array[index] = new ColorSuggestion(color, label); |
75 } | 75 } |
76 | 76 |
77 // Implemented in color_chooser_android.cc | 77 // Implemented in color_chooser_android.cc |
78 private native void nativeOnColorChosen(long nativeColorChooserAndroid, int color); | 78 private native void nativeOnColorChosen(long nativeColorChooserAndroid, int color); |
79 } | 79 } |
OLD | NEW |