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

Side by Side Diff: webkit/glue/webkitclient_impl.cc

Issue 4678006: Add form validation message strings.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | webkit/support/test_webkit_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/glue/webkitclient_impl.h" 5 #include "webkit/glue/webkitclient_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 case WebLocalizedString::AXCheckedCheckBoxActionVerb: 149 case WebLocalizedString::AXCheckedCheckBoxActionVerb:
150 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB; 150 return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
151 case WebLocalizedString::AXUncheckedCheckBoxActionVerb: 151 case WebLocalizedString::AXUncheckedCheckBoxActionVerb:
152 return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB; 152 return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB;
153 case WebLocalizedString::AXLinkActionVerb: 153 case WebLocalizedString::AXLinkActionVerb:
154 return IDS_AX_LINK_ACTION_VERB; 154 return IDS_AX_LINK_ACTION_VERB;
155 case WebLocalizedString::KeygenMenuHighGradeKeySize: 155 case WebLocalizedString::KeygenMenuHighGradeKeySize:
156 return IDS_KEYGEN_HIGH_GRADE_KEY; 156 return IDS_KEYGEN_HIGH_GRADE_KEY;
157 case WebLocalizedString::KeygenMenuMediumGradeKeySize: 157 case WebLocalizedString::KeygenMenuMediumGradeKeySize:
158 return IDS_KEYGEN_MED_GRADE_KEY; 158 return IDS_KEYGEN_MED_GRADE_KEY;
159 // TODO(tkent): Remove default: when we merge the next 159 case WebLocalizedString::ValidationValueMissing:
160 // WebLocalizedString.h change. 160 return IDS_FORM_VALIDATION_VALUE_MISSING;
161 default: 161 case WebLocalizedString::ValidationValueMissingForCheckbox:
162 break; 162 return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
163 case WebLocalizedString::ValidationValueMissingForFile:
164 return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
165 case WebLocalizedString::ValidationValueMissingForMultipleFile:
166 return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
167 case WebLocalizedString::ValidationValueMissingForRadio:
168 return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
169 case WebLocalizedString::ValidationValueMissingForSelect:
170 return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
171 case WebLocalizedString::ValidationTypeMismatch:
172 return IDS_FORM_VALIDATION_TYPE_MISMATCH;
173 case WebLocalizedString::ValidationTypeMismatchForEmail:
174 return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
175 case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
176 return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
177 case WebLocalizedString::ValidationTypeMismatchForURL:
178 return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
179 case WebLocalizedString::ValidationPatternMismatch:
180 return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
181 case WebLocalizedString::ValidationTooLong:
182 return IDS_FORM_VALIDATION_TOO_LONG;
183 case WebLocalizedString::ValidationRangeUnderflow:
184 return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
185 case WebLocalizedString::ValidationRangeOverflow:
186 return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
187 case WebLocalizedString::ValidationStepMismatch:
188 return IDS_FORM_VALIDATION_STEP_MISMATCH;
163 } 189 }
164 return -1; 190 return -1;
165 } 191 }
166 192
167 WebKitClientImpl::WebKitClientImpl() 193 WebKitClientImpl::WebKitClientImpl()
168 : main_loop_(MessageLoop::current()), 194 : main_loop_(MessageLoop::current()),
169 shared_timer_func_(NULL), 195 shared_timer_func_(NULL),
170 shared_timer_fire_time_(0.0), 196 shared_timer_fire_time_(0.0),
171 shared_timer_suspended_(0) { 197 shared_timer_suspended_(0) {
172 } 198 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 WebString WebKitClientImpl::queryLocalizedString( 330 WebString WebKitClientImpl::queryLocalizedString(
305 WebLocalizedString::Name name) { 331 WebLocalizedString::Name name) {
306 int message_id = ToMessageID(name); 332 int message_id = ToMessageID(name);
307 if (message_id < 0) 333 if (message_id < 0)
308 return WebString(); 334 return WebString();
309 return GetLocalizedString(message_id); 335 return GetLocalizedString(message_id);
310 } 336 }
311 337
312 WebString WebKitClientImpl::queryLocalizedString( 338 WebString WebKitClientImpl::queryLocalizedString(
313 WebLocalizedString::Name name, int numeric_value) { 339 WebLocalizedString::Name name, int numeric_value) {
340 return queryLocalizedString(name, base::IntToString16(numeric_value));
341 }
342
343 WebString WebKitClientImpl::queryLocalizedString(
344 WebLocalizedString::Name name, const WebString& value) {
314 int message_id = ToMessageID(name); 345 int message_id = ToMessageID(name);
315 if (message_id < 0) 346 if (message_id < 0)
316 return WebString(); 347 return WebString();
317 return ReplaceStringPlaceholders(GetLocalizedString(message_id), 348 return ReplaceStringPlaceholders(GetLocalizedString(message_id), value, NULL);
318 base::IntToString16(numeric_value), 349 }
319 NULL); 350
351 WebString WebKitClientImpl::queryLocalizedString(
352 WebLocalizedString::Name name,
353 const WebString& value1,
354 const WebString& value2) {
355 int message_id = ToMessageID(name);
356 if (message_id < 0)
357 return WebString();
358 std::vector<string16> values;
359 values.reserve(2);
360 values.push_back(value1);
361 values.push_back(value2);
362 return ReplaceStringPlaceholders(
363 GetLocalizedString(message_id), values, NULL);
320 } 364 }
321 365
322 double WebKitClientImpl::currentTime() { 366 double WebKitClientImpl::currentTime() {
323 return base::Time::Now().ToDoubleT(); 367 return base::Time::Now().ToDoubleT();
324 } 368 }
325 369
326 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) { 370 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) {
327 shared_timer_func_ = func; 371 shared_timer_func_ = func;
328 } 372 }
329 373
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 ++shared_timer_suspended_; 503 ++shared_timer_suspended_;
460 } 504 }
461 505
462 void WebKitClientImpl::ResumeSharedTimer() { 506 void WebKitClientImpl::ResumeSharedTimer() {
463 // The shared timer may have fired or been adjusted while we were suspended. 507 // The shared timer may have fired or been adjusted while we were suspended.
464 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) 508 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning())
465 setSharedTimerFireTime(shared_timer_fire_time_); 509 setSharedTimerFireTime(shared_timer_fire_time_);
466 } 510 }
467 511
468 } // namespace webkit_glue 512 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | webkit/support/test_webkit_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698