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

Unified Diff: content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java

Issue 11316153: implement input type=color for android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
Index: content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java
diff --git a/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java b/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java
new file mode 100644
index 0000000000000000000000000000000000000000..09b233ef6b3426dfe31de48c5dea001f69d4e4ce
--- /dev/null
+++ b/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.components.web_contents_delegate_android;
+
+import android.content.Context;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+import org.chromium.content.browser.ContentViewCore;
+import org.chromium.ui.ColorPickerDialog;
+
+/**
+ * ColorChooserAndroid communicates with the java ColorPickerDialog and the
+ * native color_chooser_android.cc
+ */
+@JNINamespace("content")
+public class ColorChooserAndroid {
+ private final ColorPickerDialog mDialog;
+ private final int mNativeColorChooserAndroid;
+
+ private ColorChooserAndroid(int nativeColorChooserAndroid,
+ Context context, int initialColor) {
+ ColorPickerDialog.OnColorChangedListener listener =
+ new ColorPickerDialog.OnColorChangedListener() {
+
+ @Override
+ public void colorChanged(int color) {
+ mDialog.dismiss();
+ nativeOnColorChosen(mNativeColorChooserAndroid, color);
+ }
+ };
+
+ mNativeColorChooserAndroid = nativeColorChooserAndroid;
+ mDialog = new ColorPickerDialog(context, listener, initialColor);
+ }
+
+ @CalledByNative
+ public void openColorChooser() {
+ mDialog.show();
+ }
+
+ @CalledByNative
+ public static ColorChooserAndroid createColorChooserAndroid(
+ int nativeColorChooserAndroid,
+ ContentViewCore contentViewCore, int initialColor) {
+ return new ColorChooserAndroid(nativeColorChooserAndroid,
+ contentViewCore.getContext(), initialColor);
+ }
+
+ // Implemented in color_chooser_android.cc
+ private native void nativeOnColorChosen(int nativeColorChooserAndroid, int color);
+}

Powered by Google App Engine
This is Rietveld 408576698