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

Side by Side Diff: webkit/support/test_webkit_client.cc

Issue 4678006: Add form validation message strings.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
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/support/test_webkit_client.h" 5 #include "webkit/support/test_webkit_client.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/metrics/stats_counters.h" 10 #include "base/metrics/stats_counters.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" 240 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a"
241 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" 241 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a"
242 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" 242 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
243 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" 243 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
244 "\x82"; 244 "\x82";
245 return WebKit::WebData(red_square, arraysize(red_square)); 245 return WebKit::WebData(red_square, arraysize(red_square));
246 } 246 }
247 return webkit_glue::WebKitClientImpl::loadResource(name); 247 return webkit_glue::WebKitClientImpl::loadResource(name);
248 } 248 }
249 249
250 WebKit::WebString TestWebKitClient::queryLocalizedString(
251 WebKit::WebLocalizedString::Name name) {
252 // Returns messages same as WebKit's in DRT.
253 // We use different strings for form validation messages.
254 switch (name) {
255 case WebKit::WebLocalizedString::ValidationValueMissing:
tony 2010/11/16 18:11:41 Google C++ style says case should be indented: htt
tkent 2010/11/22 10:19:06 Done.
256 return ASCIIToUTF16("value missing");
257 case WebKit::WebLocalizedString::ValidationTypeMismatch:
258 case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail:
259 case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
260 case WebKit::WebLocalizedString::ValidationTypeMismatchForURL:
261 return ASCIIToUTF16("type mismatch");
262 case WebKit::WebLocalizedString::ValidationPatternMismatch:
263 return ASCIIToUTF16("pattern mismatch");
264 case WebKit::WebLocalizedString::ValidationTooLong:
265 return ASCIIToUTF16("too long");
266 case WebKit::WebLocalizedString::ValidationRangeUnderflow:
267 return ASCIIToUTF16("range underflow");
268 case WebKit::WebLocalizedString::ValidationRangeOverflow:
269 return ASCIIToUTF16("range overflow");
270 case WebKit::WebLocalizedString::ValidationStepMismatch:
271 return ASCIIToUTF16("step mismatch");
272 default:
273 return WebKitClientImpl::queryLocalizedString(name);
274 }
275 }
276
277 WebKit::WebString TestWebKitClient::queryLocalizedString(
278 WebKit::WebLocalizedString::Name name, int value1, int value2) {
279 if (name == WebKit::WebLocalizedString::ValidationTooLong)
280 return ASCIIToUTF16("too long");
281 return WebKitClientImpl::queryLocalizedString(name, value1, value2);
282 }
283
284 WebKit::WebString TestWebKitClient::queryLocalizedString(
285 WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) {
286 if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow)
287 return ASCIIToUTF16("range underflow");
288 if (name == WebKit::WebLocalizedString::ValidationRangeOverflow)
289 return ASCIIToUTF16("range overflow");
290 return WebKitClientImpl::queryLocalizedString(name, value);
291 }
292
293 WebKit::WebString TestWebKitClient::queryLocalizedString(
294 WebKit::WebLocalizedString::Name name,
295 const WebKit::WebString& value1,
296 const WebKit::WebString& value2) {
297 if (name == WebKit::WebLocalizedString::ValidationStepMismatch)
298 return ASCIIToUTF16("step mismatch");
299 return WebKitClientImpl::queryLocalizedString(name, value1, value2);
300 }
301
250 WebKit::WebString TestWebKitClient::defaultLocale() { 302 WebKit::WebString TestWebKitClient::defaultLocale() {
251 return ASCIIToUTF16("en-US"); 303 return ASCIIToUTF16("en-US");
252 } 304 }
253 305
254 WebKit::WebStorageNamespace* TestWebKitClient::createLocalStorageNamespace( 306 WebKit::WebStorageNamespace* TestWebKitClient::createLocalStorageNamespace(
255 const WebKit::WebString& path, unsigned quota) { 307 const WebKit::WebString& path, unsigned quota) {
256 return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, quota); 308 return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, quota);
257 } 309 }
258 310
259 void TestWebKitClient::dispatchStorageEvent(const WebKit::WebString& key, 311 void TestWebKitClient::dispatchStorageEvent(const WebKit::WebString& key,
(...skipping 29 matching lines...) Expand all
289 } 341 }
290 #endif 342 #endif
291 343
292 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { 344 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() {
293 return NULL; 345 return NULL;
294 } 346 }
295 347
296 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { 348 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() {
297 return WebKit::WebGraphicsContext3D::createDefault(); 349 return WebKit::WebGraphicsContext3D::createDefault();
298 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698