[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
| 6 | #define CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |
| 7 | |
| 8 | #include <string> |
[email protected] | 6e08bfb | 2013-12-07 02:56:17 | [diff] [blame] | 9 | #include <vector> |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 10 | |
[email protected] | 6a718ab | 2014-04-23 20:01:20 | [diff] [blame] | 11 | #include "base/android/jni_weak_ref.h" |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 12 | #include "base/memory/scoped_ptr.h" |
[email protected] | e807256 | 2013-12-04 06:04:13 | [diff] [blame] | 13 | #include "ui/base/ime/text_input_type.h" |
ajith.v | 9e47ab5 | 2014-10-30 20:24:17 | [diff] [blame] | 14 | #include "ui/gfx/native_widget_types.h" |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 15 | |
| 16 | namespace content { |
| 17 | |
| 18 | class ContentViewCore; |
| 19 | class RenderViewHost; |
[email protected] | 6e08bfb | 2013-12-07 02:56:17 | [diff] [blame] | 20 | struct DateTimeSuggestion; |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 21 | |
| 22 | // Android implementation for DateTimeChooser dialogs. |
| 23 | class DateTimeChooserAndroid { |
| 24 | public: |
| 25 | DateTimeChooserAndroid(); |
| 26 | ~DateTimeChooserAndroid(); |
| 27 | |
| 28 | // DateTimeChooser implementation: |
[email protected] | e807256 | 2013-12-04 06:04:13 | [diff] [blame] | 29 | // Shows the dialog. |dialog_value| is the date/time value converted to a |
| 30 | // number as defined in HTML. (See blink::InputType::parseToNumber()) |
ajith.v | 9e47ab5 | 2014-10-30 20:24:17 | [diff] [blame] | 31 | void ShowDialog(gfx::NativeWindow native_window, |
[email protected] | 4e7f431 | 2013-10-24 00:46:06 | [diff] [blame] | 32 | RenderViewHost* host, |
[email protected] | e807256 | 2013-12-04 06:04:13 | [diff] [blame] | 33 | ui::TextInputType dialog_type, |
| 34 | double dialog_value, |
[email protected] | ee59cbec | 2013-08-16 14:59:09 | [diff] [blame] | 35 | double min, |
| 36 | double max, |
[email protected] | 6e08bfb | 2013-12-07 02:56:17 | [diff] [blame] | 37 | double step, |
| 38 | const std::vector<DateTimeSuggestion>& suggestions); |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 39 | |
[email protected] | e807256 | 2013-12-04 06:04:13 | [diff] [blame] | 40 | // Replaces the current value |
| 41 | void ReplaceDateTime(JNIEnv* env, jobject, jdouble value); |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 42 | |
| 43 | // Closes the dialog without propagating any changes. |
| 44 | void CancelDialog(JNIEnv* env, jobject); |
| 45 | |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 46 | private: |
[email protected] | 4e7f431 | 2013-10-24 00:46:06 | [diff] [blame] | 47 | RenderViewHost* host_; |
[email protected] | 2ed7c499 | 2013-04-25 18:25:44 | [diff] [blame] | 48 | |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 49 | base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid); |
| 52 | }; |
| 53 | |
| 54 | // Native JNI methods |
| 55 | bool RegisterDateTimeChooserAndroid(JNIEnv* env); |
| 56 | |
| 57 | } // namespace content |
| 58 | |
| 59 | #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_ |