| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
| 8 import org.chromium.base.JNINamespace; | 8 import org.chromium.base.JNINamespace; |
| 9 | 9 |
| 10 import android.content.Context; | 10 import android.content.Context; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Plumbing for the different date/time dialog adapters. | 13 * Plumbing for the different date/time dialog adapters. |
| 14 */ | 14 */ |
| 15 @JNINamespace("content") | 15 @JNINamespace("content") |
| 16 class DateTimeChooserAndroid { | 16 class DateTimeChooserAndroid { |
| 17 | 17 |
| 18 private final int mNativeDateTimeChooserAndroid; | 18 private final int mNativeDateTimeChooserAndroid; |
| 19 private final InputDialogContainer mInputDialogContainer; | 19 private final InputDialogContainer mInputDialogContainer; |
| 20 | 20 |
| 21 private DateTimeChooserAndroid(Context context, | 21 private DateTimeChooserAndroid(Context context, |
| 22 int nativeDateTimeChooserAndroid) { | 22 int nativeDateTimeChooserAndroid) { |
| 23 mNativeDateTimeChooserAndroid = nativeDateTimeChooserAndroid; | 23 mNativeDateTimeChooserAndroid = nativeDateTimeChooserAndroid; |
| 24 mInputDialogContainer = new InputDialogContainer(context, | 24 mInputDialogContainer = new InputDialogContainer(context, |
| 25 new InputDialogContainer.InputActionDelegate() { | 25 new InputDialogContainer.InputActionDelegate() { |
| 26 | 26 |
| 27 @Override | 27 @Override |
| 28 public void replaceDateTime(String text) { | 28 public void replaceDateTime( |
| 29 nativeReplaceDateTime(mNativeDateTimeChooserAndroid, text); | 29 int dialogType, |
| 30 int year, int month, int day, int hour, int minute, int seco
nd) { |
| 31 nativeReplaceDateTime(mNativeDateTimeChooserAndroid, |
| 32 dialogType, |
| 33 year, month, day, hour, minute, second); |
| 30 } | 34 } |
| 31 | 35 |
| 32 @Override | 36 @Override |
| 33 public void cancelDateTimeDialog() { | 37 public void cancelDateTimeDialog() { |
| 34 nativeCancelDialog(mNativeDateTimeChooserAndroid); | 38 nativeCancelDialog(mNativeDateTimeChooserAndroid); |
| 35 } | 39 } |
| 36 }); | 40 }); |
| 37 } | 41 } |
| 38 | 42 |
| 39 private void showDialog(int dialogType, String text) { | 43 private void showDialog(int dialogType, int year, int month, int monthDay, |
| 40 mInputDialogContainer.showDialog(text, dialogType); | 44 int hour, int minute, int second) { |
| 45 mInputDialogContainer.showDialog(dialogType, year, month, monthDay, |
| 46 hour, minute, second); |
| 41 } | 47 } |
| 42 | 48 |
| 43 @CalledByNative | 49 @CalledByNative |
| 44 private static DateTimeChooserAndroid createDateTimeChooser( | 50 private static DateTimeChooserAndroid createDateTimeChooser( |
| 45 ContentViewCore contentViewCore, | 51 ContentViewCore contentViewCore, |
| 46 int nativeDateTimeChooserAndroid, String text, int dialogType) { | 52 int nativeDateTimeChooserAndroid, int dialogType, |
| 53 int year, int month, int day, |
| 54 int hour, int minute, int second) { |
| 47 DateTimeChooserAndroid chooser = | 55 DateTimeChooserAndroid chooser = |
| 48 new DateTimeChooserAndroid( | 56 new DateTimeChooserAndroid( |
| 49 contentViewCore.getContext(), nativeDateTimeChooserAndro
id); | 57 contentViewCore.getContext(), nativeDateTimeChooserAndro
id); |
| 50 chooser.showDialog(dialogType, text); | 58 chooser.showDialog(dialogType, year, month, day, hour, minute, second); |
| 51 return chooser; | 59 return chooser; |
| 52 } | 60 } |
| 53 | 61 |
| 54 @CalledByNative | 62 @CalledByNative |
| 55 private static void initializeDateInputTypes(int textInputTypeDate, int text
InputTypeDateTime, | 63 private static void initializeDateInputTypes(int textInputTypeDate, int text
InputTypeDateTime, |
| 56 int textInputTypeDateTimeLocal, int textInputTypeMonth, | 64 int textInputTypeDateTimeLocal, int textInputTypeMonth, |
| 57 int textInputTypeTime) { | 65 int textInputTypeTime) { |
| 58 InputDialogContainer.initializeInputTypes(textInputTypeDate, textInputTy
peDateTime, | 66 InputDialogContainer.initializeInputTypes(textInputTypeDate, textInputTy
peDateTime, |
| 59 textInputTypeDateTimeLocal, textInputTypeMonth, textInputTypeTim
e); | 67 textInputTypeDateTimeLocal, textInputTypeMonth, textInputTypeTim
e); |
| 60 } | 68 } |
| 61 | 69 |
| 62 private native void nativeReplaceDateTime(int nativeDateTimeChooserAndroid,
String text); | 70 private native void nativeReplaceDateTime(int nativeDateTimeChooserAndroid, |
| 71 int dialogType, |
| 72 int year, int month, int day, int hour, int minute, int second); |
| 73 |
| 63 private native void nativeCancelDialog(int nativeDateTimeChooserAndroid); | 74 private native void nativeCancelDialog(int nativeDateTimeChooserAndroid); |
| 64 } | 75 } |
| OLD | NEW |