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

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

Issue 12191005: Move Android Date/Time parsing to the renderer (C++ and ICU) instead of the current parsing that ha… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased view_messages.h and fixed the link issue on the linux bot Created 7 years, 10 months 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
(Empty)
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_RENDERER_DATE_TIME_FORMATTER_H_
6 #define CONTENT_RENDERER_DATE_TIME_FORMATTER_H_
7
8 #include "base/basictypes.h"
9 #include "content/common/content_export.h"
10 #include "third_party/icu/public/common/unicode/unistr.h"
11 #include "third_party/icu/public/i18n/unicode/gregocal.h"
12 #include "ui/base/ime/text_input_type.h"
13
14 namespace WebKit {
15 struct WebDateTimeChooserParams;
16 } // namespace WebKit
17
18 namespace content {
19
20 // Converts between a text string representing a date/time and
21 // a set of year/month/day/hour/minute/second and vice versa.
22 // It is timezone agnostic.
23 class CONTENT_EXPORT DateTimeFormatter {
24 public:
25 explicit DateTimeFormatter(const WebKit::WebDateTimeChooserParams& source);
26 DateTimeFormatter(
27 ui::TextInputType type,
28 int year, int month, int day, int hour, int minute, int second);
29 ~DateTimeFormatter();
30
31 int GetYear() const;
32 int GetMonth() const;
33 int GetDay() const;
34 int GetHour() const;
35 int GetMinute() const;
36 int GetSecond() const;
37 ui::TextInputType GetType() const;
38 const std::string& GetFormattedValue() const;
joth 2013/02/07 21:49:42 this needs to #include <string>
39
40 private:
41 void CreatePatternMap();
42 bool ParseValues();
43 const std::string FormatString() const;
44 int ExtractValue(
45 const icu::Calendar* calendar, UCalendarDateFields value) const;
46 void ExtractType(const WebKit::WebDateTimeChooserParams& source);
47 void ClearAll();
48
49 ui::TextInputType type_;
50 icu::UnicodeString patterns_[ui::TEXT_INPUT_TYPE_MAX + 1];
51 int year_;
52 int month_;
53 int day_;
54 int hour_;
55 int minute_;
56 int second_;
57 const icu::UnicodeString* pattern_;
58 std::string formatted_string_;
59
60 DISALLOW_COPY_AND_ASSIGN(DateTimeFormatter);
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_RENDERER_DATE_TIME_FORMATTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698