Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: content/renderer/date_time_formatter.h

Issue 23623019: Support datalist for date/time input types on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed change to envsetup.sh Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_RENDERER_DATE_TIME_FORMATTER_H_ 5 #ifndef CONTENT_RENDERER_DATE_TIME_FORMATTER_H_
6 #define CONTENT_RENDERER_DATE_TIME_FORMATTER_H_ 6 #define CONTENT_RENDERER_DATE_TIME_FORMATTER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "third_party/icu/source/common/unicode/unistr.h" 12 #include "third_party/icu/source/common/unicode/unistr.h"
13 #include "third_party/icu/source/i18n/unicode/gregocal.h" 13 #include "third_party/icu/source/i18n/unicode/gregocal.h"
14 #include "ui/base/ime/text_input_type.h" 14 #include "ui/base/ime/text_input_type.h"
15 15
16 namespace WebKit { 16 namespace WebKit {
17 struct WebDateTimeChooserParams; 17 struct WebDateTimeChooserParams;
18 } // namespace WebKit 18 } // namespace WebKit
19 19
20 namespace content { 20 namespace content {
21 21
22 // Converts between a text string representing a date/time and 22 // Converts between a text string representing a date/time and
23 // a set of year/month/day/hour/minute/second/milli and vice versa. 23 // a set of year/month/day/hour/minute/second/milli and vice versa.
24 // It is timezone agnostic. 24 // It is timezone agnostic.
25 class CONTENT_EXPORT DateTimeFormatter { 25 class CONTENT_EXPORT DateTimeFormatter {
26 public: 26 public:
27 explicit DateTimeFormatter(const WebKit::WebDateTimeChooserParams& source);
28 DateTimeFormatter(ui::TextInputType type, 27 DateTimeFormatter(ui::TextInputType type,
29 int year, 28 int year,
30 int month, 29 int month,
31 int day, 30 int day,
32 int hour, 31 int hour,
33 int minute, 32 int minute,
34 int second, 33 int second,
35 int milli, 34 int milli,
36 int week_year, 35 int week_year,
37 int week); 36 int week);
38 ~DateTimeFormatter(); 37 ~DateTimeFormatter();
39 38
40 int GetYear() const;
41 int GetMonth() const;
42 int GetDay() const;
43 int GetHour() const;
44 int GetMinute() const;
45 int GetSecond() const;
46 int GetMilli() const;
47 int GetWeekYear() const;
48 int GetWeek() const;
49 ui::TextInputType GetType() const;
50 const std::string& GetFormattedValue() const; 39 const std::string& GetFormattedValue() const;
51 40
52 private: 41 private:
53 void CreatePatternMap(); 42 void CreatePatternMap();
54 bool ParseValues(); 43 bool ParseValues();
55 const std::string FormatString() const; 44 const std::string FormatString() const;
56 int ExtractValue( 45 int ExtractValue(
57 const icu::Calendar* calendar, UCalendarDateFields value) const; 46 const icu::Calendar* calendar, UCalendarDateFields value) const;
58 void ExtractType(const WebKit::WebDateTimeChooserParams& source); 47 void ExtractType(const WebKit::WebDateTimeChooserParams& source);
59 void ClearAll(); 48 void ClearAll();
(...skipping 12 matching lines...) Expand all
72 int week_; 61 int week_;
73 const icu::UnicodeString* pattern_; 62 const icu::UnicodeString* pattern_;
74 std::string formatted_string_; 63 std::string formatted_string_;
75 64
76 DISALLOW_COPY_AND_ASSIGN(DateTimeFormatter); 65 DISALLOW_COPY_AND_ASSIGN(DateTimeFormatter);
77 }; 66 };
78 67
79 } // namespace content 68 } // namespace content
80 69
81 #endif // CONTENT_RENDERER_DATE_TIME_FORMATTER_H_ 70 #endif // CONTENT_RENDERER_DATE_TIME_FORMATTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698