Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / android / date_time_chooser_android.h
blobb47ed5ec7c5f38e51234fb9873d580c61b0ef354
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.
5 #ifndef CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_
8 #include <string>
9 #include <vector>
11 #include "base/android/jni_weak_ref.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/base/ime/text_input_type.h"
15 namespace content {
17 class ContentViewCore;
18 class RenderViewHost;
19 struct DateTimeSuggestion;
21 // Android implementation for DateTimeChooser dialogs.
22 class DateTimeChooserAndroid {
23 public:
24 DateTimeChooserAndroid();
25 ~DateTimeChooserAndroid();
27 // DateTimeChooser implementation:
28 // Shows the dialog. |dialog_value| is the date/time value converted to a
29 // number as defined in HTML. (See blink::InputType::parseToNumber())
30 void ShowDialog(ContentViewCore* content,
31 RenderViewHost* host,
32 ui::TextInputType dialog_type,
33 double dialog_value,
34 double min,
35 double max,
36 double step,
37 const std::vector<DateTimeSuggestion>& suggestions);
39 // Replaces the current value
40 void ReplaceDateTime(JNIEnv* env, jobject, jdouble value);
42 // Closes the dialog without propagating any changes.
43 void CancelDialog(JNIEnv* env, jobject);
45 // Propagates the different types of accepted date/time values to the
46 // java side.
47 static void InitializeDateInputTypes(
48 int text_input_type_date, int text_input_type_date_time,
49 int text_input_type_date_time_local, int text_input_type_month,
50 int text_input_type_time, int text_input_type_week);
52 private:
53 RenderViewHost* host_;
55 base::android::ScopedJavaGlobalRef<jobject> j_date_time_chooser_;
57 DISALLOW_COPY_AND_ASSIGN(DateTimeChooserAndroid);
60 // Native JNI methods
61 bool RegisterDateTimeChooserAndroid(JNIEnv* env);
63 } // namespace content
65 #endif // CONTENT_BROWSER_ANDROID_DATE_TIME_CHOOSER_ANDROID_H_