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