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 #ifndef CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
6 #define CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/android/jni_helper.h" | 11 #include "base/android/jni_helper.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class ContentViewCore; | 16 class ContentViewCore; |
16 class RenderViewHost; | 17 class RenderViewHost; |
| 18 struct DateTimeSuggestion; |
17 | 19 |
18 // Android implementation for DateTimeChooser dialogs. | 20 // Android implementation for DateTimeChooser dialogs. |
19 class DateTimeChooserAndroid { | 21 class DateTimeChooserAndroid { |
20 public: | 22 public: |
21 DateTimeChooserAndroid(); | 23 DateTimeChooserAndroid(); |
22 ~DateTimeChooserAndroid(); | 24 ~DateTimeChooserAndroid(); |
23 | 25 |
24 // DateTimeChooser implementation: | 26 // DateTimeChooser implementation: |
25 void ShowDialog(ContentViewCore* content, | 27 void ShowDialog(ContentViewCore* content, |
26 RenderViewHost* sender, | 28 RenderViewHost* sender, |
27 int type, | 29 int type, |
28 int year, | 30 int year, |
29 int month, | 31 int month, |
30 int day, | 32 int day, |
31 int hour, | 33 int hour, |
32 int minute, | 34 int minute, |
33 int second, | 35 int second, |
34 int milli, | 36 int milli, |
35 int week, | 37 int week, |
36 double min, | 38 double min, |
37 double max, | 39 double max, |
38 double step); | 40 double step, |
| 41 std::vector<DateTimeSuggestion> suggestions); |
39 | 42 |
40 // Replaces the current value with the one passed the different fields | 43 // Replaces the current value with the one passed the different fields |
41 void ReplaceDateTime(JNIEnv* env, | 44 void ReplaceDateTime(JNIEnv* env, |
42 jobject, | 45 jobject, |
43 jint dialog_type, | 46 jint dialog_type, |
44 jint year, | 47 jint year, |
45 jint month, | 48 jint month, |
46 jint day, | 49 jint day, |
47 jint hour, | 50 jint hour, |
48 jint minute, | 51 jint minute, |
49 jint second, | 52 jint second, |
50 jint milli, | 53 jint milli, |
51 jint week); | 54 jint week); |
52 | 55 |
53 // Closes the dialog without propagating any changes. | 56 // Closes the dialog without propagating any changes. |
54 void CancelDialog(JNIEnv* env, jobject); | 57 void CancelDialog(JNIEnv* env, jobject); |
55 | 58 |
| 59 // Replaces the current value with the one passed the different fields |
| 60 void AcceptDataListSuggestion(JNIEnv* env, |
| 61 jobject, |
| 62 jstring value); |
| 63 |
56 // Propagates the different types of accepted date/time values to the | 64 // Propagates the different types of accepted date/time values to the |
57 // java side. | 65 // java side. |
58 static void InitializeDateInputTypes( | 66 static void InitializeDateInputTypes( |
59 int text_input_type_date, int text_input_type_date_time, | 67 int text_input_type_date, int text_input_type_date_time, |
60 int text_input_type_date_time_local, int text_input_type_month, | 68 int text_input_type_date_time_local, int text_input_type_month, |
61 int text_input_type_time, int text_input_type_week); | 69 int text_input_type_time, int text_input_type_week); |
62 | 70 |
63 private: | 71 private: |
64 class DateTimeIPCSender; | 72 class DateTimeIPCSender; |
65 | 73 |
66 // The DateTimeIPCSender class is a render view observer, so it will take care | 74 // The DateTimeIPCSender class is a render view observer, so it will take care |
67 // of its own deletion. | 75 // of its own deletion. |
68 DateTimeIPCSender* sender_; | 76 DateTimeIPCSender* sender_; |
69 | 77 |
70 base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_; | 78 base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_; |
71 | 79 |
72 DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid); | 80 DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid); |
73 }; | 81 }; |
74 | 82 |
75 // Native JNI methods | 83 // Native JNI methods |
76 bool RegisterDateTimeChooserAndroid(JNIEnv* env); | 84 bool RegisterDateTimeChooserAndroid(JNIEnv* env); |
77 | 85 |
78 } // namespace content | 86 } // namespace content |
79 | 87 |
80 #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ | 88 #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
OLD | NEW |