Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/DateTimeChooserAndroid.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/DateTimeChooserAndroid.java b/content/public/android/java/src/org/chromium/content/browser/DateTimeChooserAndroid.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88be1594b9a2f556523c7b7009398423edfc2cb9 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/DateTimeChooserAndroid.java |
| @@ -0,0 +1,64 @@ |
| +// Copyright (c) 2013 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.browser; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.base.JNINamespace; |
| + |
| +import android.content.Context; |
| + |
| +/** |
| + * Plumbing for the different date/time dialog adapters. |
| + */ |
| +@JNINamespace("content") |
| +class DateTimeChooserAndroid { |
| + |
| + private final int mNativeDateTimeChooserAndroid; |
| + private final InputDialogContainer mInputDialogContainer; |
| + |
| + DateTimeChooserAndroid(Context context, |
|
bulach
2013/01/17 10:32:21
nit: private here and maybe on the @CalledByNative
Miguel Garcia
2013/01/17 12:17:40
Done.
|
| + int nativeDateTimeChooserAndroid) { |
| + mNativeDateTimeChooserAndroid = nativeDateTimeChooserAndroid; |
| + mInputDialogContainer = new InputDialogContainer(context, |
| + new InputDialogContainer.InputActionDelegate() { |
| + |
| + @Override |
| + public void replaceDateTime(String text) { |
| + nativeReplaceDateTime(mNativeDateTimeChooserAndroid, text); |
| + } |
| + |
| + @Override |
| + public void cancelDateTimeDialog() { |
| + nativeCancelDialog(mNativeDateTimeChooserAndroid); |
| + } |
| + }); |
| + } |
| + |
| + private void showDialog(int dialogType, String text) { |
| + mInputDialogContainer.showDialog(text, dialogType); |
| + } |
| + |
| + @CalledByNative |
| + static DateTimeChooserAndroid createDateTimeChooser( |
| + ContentViewCore contentViewCore, |
| + int nativeDateTimeChooserAndroid, String text, int dialogType) { |
| + DateTimeChooserAndroid chooser = |
| + new DateTimeChooserAndroid( |
| + contentViewCore.getContext(), nativeDateTimeChooserAndroid); |
| + chooser.showDialog(dialogType, text); |
| + return chooser; |
| + } |
| + |
| + @CalledByNative |
| + static void initializeDateInputTypes(int textInputTypeDate, int textInputTypeDateTime, |
| + int textInputTypeDateTimeLocal, int textInputTypeMonth, |
| + int textInputTypeTime) { |
| + InputDialogContainer.initializeInputTypes(textInputTypeDate, textInputTypeDateTime, |
| + textInputTypeDateTimeLocal, textInputTypeMonth, textInputTypeTime); |
| + } |
| + |
| + private native void nativeReplaceDateTime(int nativeDateTimeChooserAndroid, String text); |
| + private native void nativeCancelDialog(int nativeDateTimeChooserAndroid); |
| +} |