Chromium Code Reviews| 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 #include "ui/base/ime/text_input_type.h" | 13 #include "ui/base/ime/text_input_type.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class ContentViewCore; | 17 class ContentViewCore; |
| 17 class RenderViewHost; | 18 class RenderViewHost; |
| 19 struct DateTimeSuggestion; | |
| 18 | 20 |
| 19 // Android implementation for DateTimeChooser dialogs. | 21 // Android implementation for DateTimeChooser dialogs. |
| 20 class DateTimeChooserAndroid { | 22 class DateTimeChooserAndroid { |
| 21 public: | 23 public: |
| 22 DateTimeChooserAndroid(); | 24 DateTimeChooserAndroid(); |
| 23 ~DateTimeChooserAndroid(); | 25 ~DateTimeChooserAndroid(); |
| 24 | 26 |
| 25 // DateTimeChooser implementation: | 27 // DateTimeChooser implementation: |
| 26 // Shows the dialog. |dialog_value| is the date/time value converted to a | 28 // Shows the dialog. |dialog_value| is the date/time value converted to a |
| 27 // number as defined in HTML. (See blink::InputType::parseToNumber()) | 29 // number as defined in HTML. (See blink::InputType::parseToNumber()) |
| 28 void ShowDialog(ContentViewCore* content, | 30 void ShowDialog(ContentViewCore* content, |
| 29 RenderViewHost* host, | 31 RenderViewHost* host, |
| 30 ui::TextInputType dialog_type, | 32 ui::TextInputType dialog_type, |
| 31 double dialog_value, | 33 double dialog_value, |
| 32 double min, | 34 double min, |
| 33 double max, | 35 double max, |
| 34 double step); | 36 double step, |
| 37 std::vector<DateTimeSuggestion> suggestions); | |
|
bulach
2013/12/03 14:22:29
nit: pass as const&?
keishi
2013/12/03 16:52:34
Done.
| |
| 35 | 38 |
| 36 // Replaces the current value | 39 // Replaces the current value |
| 37 void ReplaceDateTime(JNIEnv* env, jobject, jdouble value); | 40 void ReplaceDateTime(JNIEnv* env, jobject, jdouble value); |
| 38 | 41 |
| 39 // Closes the dialog without propagating any changes. | 42 // Closes the dialog without propagating any changes. |
| 40 void CancelDialog(JNIEnv* env, jobject); | 43 void CancelDialog(JNIEnv* env, jobject); |
| 41 | 44 |
| 42 // Propagates the different types of accepted date/time values to the | 45 // Propagates the different types of accepted date/time values to the |
| 43 // java side. | 46 // java side. |
| 44 static void InitializeDateInputTypes( | 47 static void InitializeDateInputTypes( |
| 45 int text_input_type_date, int text_input_type_date_time, | 48 int text_input_type_date, int text_input_type_date_time, |
| 46 int text_input_type_date_time_local, int text_input_type_month, | 49 int text_input_type_date_time_local, int text_input_type_month, |
| 47 int text_input_type_time, int text_input_type_week); | 50 int text_input_type_time, int text_input_type_week); |
| 48 | 51 |
| 49 private: | 52 private: |
| 50 RenderViewHost* host_; | 53 RenderViewHost* host_; |
| 51 | 54 |
| 52 base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_; | 55 base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid); | 57 DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 // Native JNI methods | 60 // Native JNI methods |
| 58 bool RegisterDateTimeChooserAndroid(JNIEnv* env); | 61 bool RegisterDateTimeChooserAndroid(JNIEnv* env); |
| 59 | 62 |
| 60 } // namespace content | 63 } // namespace content |
| 61 | 64 |
| 62 #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ | 65 #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
| OLD | NEW |