OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
33 #include "web/DateTimeChooserImpl.h" | 33 #include "web/DateTimeChooserImpl.h" |
34 | 34 |
35 #include "core/InputTypeNames.h" | 35 #include "core/InputTypeNames.h" |
36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
37 #include "core/rendering/RenderTheme.h" | 37 #include "core/rendering/RenderTheme.h" |
38 #include "platform/DateComponents.h" | 38 #include "platform/DateComponents.h" |
39 #include "platform/DateTimeChooserClient.h" | 39 #include "platform/DateTimeChooserClient.h" |
40 #include "platform/Language.h" | 40 #include "platform/Language.h" |
41 #include "platform/text/PlatformLocale.h" | 41 #include "platform/text/PlatformLocale.h" |
42 #include "web/CalendarPicker.h" | 42 #include "public/platform/Platform.h" |
43 #include "web/ChromeClientImpl.h" | 43 #include "web/ChromeClientImpl.h" |
44 #include "web/PickerCommon.h" | |
45 #include "web/WebViewImpl.h" | 44 #include "web/WebViewImpl.h" |
46 | 45 |
47 using namespace WebCore; | 46 using namespace WebCore; |
48 | 47 |
49 namespace blink { | 48 namespace blink { |
50 | 49 |
51 DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore
::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& param
eters) | 50 DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore
::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& param
eters) |
52 : m_chromeClient(chromeClient) | 51 : m_chromeClient(chromeClient) |
53 , m_client(client) | 52 , m_client(client) |
54 , m_popup(0) | 53 , m_popup(0) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 otherDateLabelString = locale().queryString(WebLocalizedString::OtherMon
thLabel); | 110 otherDateLabelString = locale().queryString(WebLocalizedString::OtherMon
thLabel); |
112 } else if (m_parameters.type == WebCore::InputTypeNames::week) { | 111 } else if (m_parameters.type == WebCore::InputTypeNames::week) { |
113 todayLabelString = locale().queryString(WebLocalizedString::ThisWeekButt
onLabel); | 112 todayLabelString = locale().queryString(WebLocalizedString::ThisWeekButt
onLabel); |
114 otherDateLabelString = locale().queryString(WebLocalizedString::OtherWee
kLabel); | 113 otherDateLabelString = locale().queryString(WebLocalizedString::OtherWee
kLabel); |
115 } else { | 114 } else { |
116 todayLabelString = locale().queryString(WebLocalizedString::CalendarToda
y); | 115 todayLabelString = locale().queryString(WebLocalizedString::CalendarToda
y); |
117 otherDateLabelString = locale().queryString(WebLocalizedString::OtherDat
eLabel); | 116 otherDateLabelString = locale().queryString(WebLocalizedString::OtherDat
eLabel); |
118 } | 117 } |
119 | 118 |
120 addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data); | 119 addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data); |
121 data->append(pickerCommonCss, sizeof(pickerCommonCss)); | 120 data->append(blink::Platform::current()->loadResource("pickerCommon.css")); |
122 data->append(pickerButtonCss, sizeof(pickerButtonCss)); | 121 data->append(blink::Platform::current()->loadResource("pickerButton.css")); |
123 data->append(suggestionPickerCss, sizeof(suggestionPickerCss)); | 122 data->append(blink::Platform::current()->loadResource("suggestionPicker.css"
)); |
124 data->append(calendarPickerCss, sizeof(calendarPickerCss)); | 123 data->append(blink::Platform::current()->loadResource("calendarPicker.css"))
; |
125 addString("</style></head><body><div id=main>Loading...</div><script>\n" | 124 addString("</style></head><body><div id=main>Loading...</div><script>\n" |
126 "window.dialogArguments = {\n", data); | 125 "window.dialogArguments = {\n", data); |
127 addProperty("anchorRectInScreen", anchorRectInScreen, data); | 126 addProperty("anchorRectInScreen", anchorRectInScreen, data); |
128 addProperty("min", valueToDateTimeString(m_parameters.minimum, m_parameters.
type), data); | 127 addProperty("min", valueToDateTimeString(m_parameters.minimum, m_parameters.
type), data); |
129 addProperty("max", valueToDateTimeString(m_parameters.maximum, m_parameters.
type), data); | 128 addProperty("max", valueToDateTimeString(m_parameters.maximum, m_parameters.
type), data); |
130 addProperty("step", stepString, data); | 129 addProperty("step", stepString, data); |
131 addProperty("stepBase", stepBaseString, data); | 130 addProperty("stepBase", stepBaseString, data); |
132 addProperty("required", m_parameters.required, data); | 131 addProperty("required", m_parameters.required, data); |
133 addProperty("currentValue", valueToDateTimeString(m_parameters.doubleValue,
m_parameters.type), data); | 132 addProperty("currentValue", valueToDateTimeString(m_parameters.doubleValue,
m_parameters.type), data); |
134 addProperty("locale", m_parameters.locale.string(), data); | 133 addProperty("locale", m_parameters.locale.string(), data); |
(...skipping 19 matching lines...) Expand all Loading... |
154 addProperty("localizedSuggestionValues", localizedSuggestionValues, data
); | 153 addProperty("localizedSuggestionValues", localizedSuggestionValues, data
); |
155 addProperty("suggestionLabels", suggestionLabels, data); | 154 addProperty("suggestionLabels", suggestionLabels, data); |
156 addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectI
nRootView.width()), data); | 155 addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectI
nRootView.width()), data); |
157 addProperty("showOtherDateEntry", WebCore::RenderTheme::theme().supports
CalendarPicker(m_parameters.type), data); | 156 addProperty("showOtherDateEntry", WebCore::RenderTheme::theme().supports
CalendarPicker(m_parameters.type), data); |
158 addProperty("otherDateLabel", otherDateLabelString, data); | 157 addProperty("otherDateLabel", otherDateLabelString, data); |
159 addProperty("suggestionHighlightColor", WebCore::RenderTheme::theme().ac
tiveListBoxSelectionBackgroundColor().serialized(), data); | 158 addProperty("suggestionHighlightColor", WebCore::RenderTheme::theme().ac
tiveListBoxSelectionBackgroundColor().serialized(), data); |
160 addProperty("suggestionHighlightTextColor", WebCore::RenderTheme::theme(
).activeListBoxSelectionForegroundColor().serialized(), data); | 159 addProperty("suggestionHighlightTextColor", WebCore::RenderTheme::theme(
).activeListBoxSelectionForegroundColor().serialized(), data); |
161 } | 160 } |
162 addString("}\n", data); | 161 addString("}\n", data); |
163 | 162 |
164 data->append(pickerCommonJs, sizeof(pickerCommonJs)); | 163 data->append(blink::Platform::current()->loadResource("pickerCommon.js")); |
165 data->append(suggestionPickerJs, sizeof(suggestionPickerJs)); | 164 data->append(blink::Platform::current()->loadResource("suggestionPicker.js")
); |
166 data->append(calendarPickerJs, sizeof(calendarPickerJs)); | 165 data->append(blink::Platform::current()->loadResource("calendarPicker.js")); |
167 addString("</script></body>\n", data); | 166 addString("</script></body>\n", data); |
168 } | 167 } |
169 | 168 |
170 WebCore::Locale& DateTimeChooserImpl::locale() | 169 WebCore::Locale& DateTimeChooserImpl::locale() |
171 { | 170 { |
172 return *m_locale; | 171 return *m_locale; |
173 } | 172 } |
174 | 173 |
175 void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stri
ngValue) | 174 void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stri
ngValue) |
176 { | 175 { |
(...skipping 22 matching lines...) Expand all Loading... |
199 | 198 |
200 void DateTimeChooserImpl::trace(Visitor* visitor) | 199 void DateTimeChooserImpl::trace(Visitor* visitor) |
201 { | 200 { |
202 visitor->trace(m_client); | 201 visitor->trace(m_client); |
203 DateTimeChooser::trace(visitor); | 202 DateTimeChooser::trace(visitor); |
204 } | 203 } |
205 | 204 |
206 } // namespace blink | 205 } // namespace blink |
207 | 206 |
208 #endif // ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 207 #endif // ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
OLD | NEW |