summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webkitclient_impl.cc
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-25 05:37:37 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-25 05:37:37 +0000
commit8ef5716c097776a9ae5c93e895c0effe7695a985 (patch)
tree197a96d2fdcf0ffcd0e90f205222b877b14506e5 /webkit/glue/webkitclient_impl.cc
parent7fb865207d11400bc69b15fef20c5e4826c221c2 (diff)
downloadchromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.zip
chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.gz
chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.bz2
Add form validation message strings.
* webkit/glue/ - Add overloads of queryLocalizedString() functions They will be added to WebKit::WebKitClient later. - Add implementations for WebLocalizedString::Validation* - Add message strings The English strings are different from WebKit's to avoid the brusque WebKit's strings. Port some messages from Mozilla. * webkit/tools/test_shell/ and webkit/support/ Hook queryLocalizedString() functions in order to return messages same as WebKit in layout test. BUG=28264 TEST=LayoutTests/fast/forms/validationMessage.html Review URL: http://codereview.chromium.org/4678006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webkitclient_impl.cc')
-rw-r--r--webkit/glue/webkitclient_impl.cc58
1 files changed, 51 insertions, 7 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 0c5766a..a992355 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -156,10 +156,36 @@ static int ToMessageID(WebLocalizedString::Name name) {
return IDS_KEYGEN_HIGH_GRADE_KEY;
case WebLocalizedString::KeygenMenuMediumGradeKeySize:
return IDS_KEYGEN_MED_GRADE_KEY;
- // TODO(tkent): Remove default: when we merge the next
- // WebLocalizedString.h change.
- default:
- break;
+ case WebLocalizedString::ValidationValueMissing:
+ return IDS_FORM_VALIDATION_VALUE_MISSING;
+ case WebLocalizedString::ValidationValueMissingForCheckbox:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
+ case WebLocalizedString::ValidationValueMissingForFile:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
+ case WebLocalizedString::ValidationValueMissingForMultipleFile:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
+ case WebLocalizedString::ValidationValueMissingForRadio:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
+ case WebLocalizedString::ValidationValueMissingForSelect:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
+ case WebLocalizedString::ValidationTypeMismatch:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH;
+ case WebLocalizedString::ValidationTypeMismatchForEmail:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
+ case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
+ case WebLocalizedString::ValidationTypeMismatchForURL:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
+ case WebLocalizedString::ValidationPatternMismatch:
+ return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
+ case WebLocalizedString::ValidationTooLong:
+ return IDS_FORM_VALIDATION_TOO_LONG;
+ case WebLocalizedString::ValidationRangeUnderflow:
+ return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
+ case WebLocalizedString::ValidationRangeOverflow:
+ return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
+ case WebLocalizedString::ValidationStepMismatch:
+ return IDS_FORM_VALIDATION_STEP_MISMATCH;
}
return -1;
}
@@ -311,12 +337,30 @@ WebString WebKitClientImpl::queryLocalizedString(
WebString WebKitClientImpl::queryLocalizedString(
WebLocalizedString::Name name, int numeric_value) {
+ return queryLocalizedString(name, base::IntToString16(numeric_value));
+}
+
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name, const WebString& value) {
+ int message_id = ToMessageID(name);
+ if (message_id < 0)
+ return WebString();
+ return ReplaceStringPlaceholders(GetLocalizedString(message_id), value, NULL);
+}
+
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name,
+ const WebString& value1,
+ const WebString& value2) {
int message_id = ToMessageID(name);
if (message_id < 0)
return WebString();
- return ReplaceStringPlaceholders(GetLocalizedString(message_id),
- base::IntToString16(numeric_value),
- NULL);
+ std::vector<string16> values;
+ values.reserve(2);
+ values.push_back(value1);
+ values.push_back(value2);
+ return ReplaceStringPlaceholders(
+ GetLocalizedString(message_id), values, NULL);
}
double WebKitClientImpl::currentTime() {