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

Side by Side Diff: content/renderer/renderer_date_time_picker.cc

Issue 11783088: Split Date/Time picker values from IME processing since date/time related form values have been com… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/renderer/renderer_date_time_picker.h" 5 #include "content/renderer/renderer_date_time_picker.h"
6 6
7 #include "base/string_util.h"
7 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
8 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
9 10
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserCom pletion.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserCom pletion.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserPar ams.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserPar ams.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeInputType. h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeInputType. h"
13 14
14 namespace content { 15 namespace content {
15 16
16 using WebKit::WebString; 17 using WebKit::WebString;
(...skipping 22 matching lines...) Expand all
39 if (source.type == WebKit::WebDateTimeInputTypeMonth) 40 if (source.type == WebKit::WebDateTimeInputTypeMonth)
40 return ui::TEXT_INPUT_TYPE_MONTH; 41 return ui::TEXT_INPUT_TYPE_MONTH;
41 if (source.type == WebKit::WebDateTimeInputTypeTime) 42 if (source.type == WebKit::WebDateTimeInputTypeTime)
42 return ui::TEXT_INPUT_TYPE_TIME; 43 return ui::TEXT_INPUT_TYPE_TIME;
43 if (source.type == WebKit::WebDateTimeInputTypeWeek) 44 if (source.type == WebKit::WebDateTimeInputTypeWeek)
44 return ui::TEXT_INPUT_TYPE_WEEK; 45 return ui::TEXT_INPUT_TYPE_WEEK;
45 return ui::TEXT_INPUT_TYPE_NONE; 46 return ui::TEXT_INPUT_TYPE_NONE;
46 } 47 }
47 48
48 bool RendererDateTimePicker::Open() { 49 bool RendererDateTimePicker::Open() {
49 ViewHostMsg_TextInputState_Params p; 50 Send(new ViewHostMsg_OpenDateTimeDialog(
50 p.type = ExtractType(chooser_params_); 51 routing_id(), ExtractType(chooser_params_),
51 p.value = chooser_params_.currentValue.utf8(); 52 chooser_params_.currentValue.utf8()));
52 p.show_ime_if_needed = true;
53 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), p));
54 return true; 53 return true;
55 } 54 }
56 55
57 bool RendererDateTimePicker::OnMessageReceived( 56 bool RendererDateTimePicker::OnMessageReceived(
58 const IPC::Message& message) { 57 const IPC::Message& message) {
59 bool handled = true; 58 bool handled = true;
60 IPC_BEGIN_MESSAGE_MAP(RendererDateTimePicker, message) 59 IPC_BEGIN_MESSAGE_MAP(RendererDateTimePicker, message)
61 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceDateTime, OnReplaceDateTime) 60 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceDateTime, OnReplaceDateTime)
62 IPC_MESSAGE_HANDLER(ViewMsg_CancelDateTimeDialog, OnCancel) 61 IPC_MESSAGE_HANDLER(ViewMsg_CancelDateTimeDialog, OnCancel)
63 IPC_MESSAGE_UNHANDLED(handled = false) 62 IPC_MESSAGE_UNHANDLED(handled = false)
64 IPC_END_MESSAGE_MAP() 63 IPC_END_MESSAGE_MAP()
65 return handled; 64 return handled;
66 } 65 }
67 66
68 void RendererDateTimePicker::OnReplaceDateTime(const string16& new_date) { 67 void RendererDateTimePicker::OnReplaceDateTime(const string16& new_date) {
69 if (chooser_completion_) 68 if (chooser_completion_)
70 chooser_completion_->didChooseValue(new_date); 69 chooser_completion_->didChooseValue(new_date);
71 } 70 }
72 71
73 void RendererDateTimePicker::OnCancel() { 72 void RendererDateTimePicker::OnCancel() {
74 if (chooser_completion_) 73 if (chooser_completion_)
75 chooser_completion_->didCancelChooser(); 74 chooser_completion_->didCancelChooser();
76 } 75 }
77 76
78 } // namespace content 77 } // namespace content
OLDNEW
« content/public/browser/date_time_chooser.h ('K') | « content/public/browser/date_time_chooser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698