summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkeishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 07:54:41 +0000
committerkeishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-06 07:54:41 +0000
commit94be485ba7e58e0e16fa745160e3777f2bc8ee12 (patch)
tree34c9ecb7ef091a1f14b361402ebe6d2f5c51ff4b
parent2c1565599418001889fe9e3eaf81848fada16c0c (diff)
downloadchromium_src-94be485ba7e58e0e16fa745160e3777f2bc8ee12.zip
chromium_src-94be485ba7e58e0e16fa745160e3777f2bc8ee12.tar.gz
chromium_src-94be485ba7e58e0e16fa745160e3777f2bc8ee12.tar.bz2
Fix mistake when setting dialog type for date/time dialog
There was a mistake in r238594 which caused the date/time dialog to not open. BUG=None Review URL: https://codereview.chromium.org/106573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239145 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/renderer_date_time_picker.cc41
1 files changed, 26 insertions, 15 deletions
diff --git a/content/renderer/renderer_date_time_picker.cc b/content/renderer/renderer_date_time_picker.cc
index 46f0c38..8c3a8f2 100644
--- a/content/renderer/renderer_date_time_picker.cc
+++ b/content/renderer/renderer_date_time_picker.cc
@@ -16,20 +16,31 @@ using blink::WebString;
namespace content {
-COMPILE_ASSERT(int(blink::WebTextInputTypeDate) == \
- int(ui::TEXT_INPUT_TYPE_DATE), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeDateTime) == \
- int(ui::TEXT_INPUT_TYPE_DATE_TIME), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeDateTimeLocal) == \
- int(ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeMonth) == \
- int(ui::TEXT_INPUT_TYPE_MONTH), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeTime) == \
- int(ui::TEXT_INPUT_TYPE_TIME), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeWeek) == \
- int(ui::TEXT_INPUT_TYPE_WEEK), mismatching_enum);
-COMPILE_ASSERT(int(blink::WebTextInputTypeDateTimeField) == \
- int(ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD), mismatching_enums);
+static ui::TextInputType ToTextInputType(int type) {
+ switch (type) {
+ case blink::WebDateTimeInputTypeDate:
+ return ui::TEXT_INPUT_TYPE_DATE;
+ break;
+ case blink::WebDateTimeInputTypeDateTime:
+ return ui::TEXT_INPUT_TYPE_DATE_TIME;
+ break;
+ case blink::WebDateTimeInputTypeDateTimeLocal:
+ return ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL;
+ break;
+ case blink::WebDateTimeInputTypeMonth:
+ return ui::TEXT_INPUT_TYPE_MONTH;
+ break;
+ case blink::WebDateTimeInputTypeTime:
+ return ui::TEXT_INPUT_TYPE_TIME;
+ break;
+ case blink::WebDateTimeInputTypeWeek:
+ return ui::TEXT_INPUT_TYPE_WEEK;
+ break;
+ case blink::WebDateTimeInputTypeNone:
+ default:
+ return ui::TEXT_INPUT_TYPE_NONE;
+ }
+}
RendererDateTimePicker::RendererDateTimePicker(
RenderViewImpl* sender,
@@ -45,7 +56,7 @@ RendererDateTimePicker::~RendererDateTimePicker() {
bool RendererDateTimePicker::Open() {
ViewHostMsg_DateTimeDialogValue_Params message;
- message.dialog_type = static_cast<ui::TextInputType>(chooser_params_.type);
+ message.dialog_type = ToTextInputType(chooser_params_.type);
message.dialog_value = chooser_params_.doubleValue;
message.minimum = chooser_params_.minimum;
message.maximum = chooser_params_.maximum;