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

Side by Side Diff: Source/modules/notifications/Notification.cpp

Issue 1110223002: Use and add layout tests for BCP 47 language tag syntax validation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (options.hasData()) { 89 if (options.hasData()) {
90 data = SerializedScriptValueFactory::instance().create(options.data(), n ullptr, exceptionState, options.data().isolate()); 90 data = SerializedScriptValueFactory::instance().create(options.data(), n ullptr, exceptionState, options.data().isolate());
91 if (exceptionState.hadException()) 91 if (exceptionState.hadException())
92 return nullptr; 92 return nullptr;
93 } 93 }
94 94
95 Notification* notification = new Notification(title, context); 95 Notification* notification = new Notification(title, context);
96 96
97 notification->setBody(options.body()); 97 notification->setBody(options.body());
98 notification->setTag(options.tag()); 98 notification->setTag(options.tag());
99 notification->setLang(options.lang()); 99
100 if (Platform::current()->isValidLocaleSyntax(options.lang()))
101 notification->setLang(options.lang());
102
100 notification->setDir(options.dir()); 103 notification->setDir(options.dir());
101 notification->setVibrate(NavigatorVibration::sanitizeVibrationPattern(option s.vibrate())); 104 notification->setVibrate(NavigatorVibration::sanitizeVibrationPattern(option s.vibrate()));
102 notification->setSilent(options.silent()); 105 notification->setSilent(options.silent());
103 notification->setSerializedData(data.release()); 106 notification->setSerializedData(data.release());
104 if (options.hasIcon()) { 107 if (options.hasIcon()) {
105 KURL iconUrl = options.icon().isEmpty() ? KURL() : context->completeURL( options.icon()); 108 KURL iconUrl = options.icon().isEmpty() ? KURL() : context->completeURL( options.icon());
106 if (!iconUrl.isEmpty() && iconUrl.isValid()) 109 if (!iconUrl.isEmpty() && iconUrl.isValid())
107 notification->setIconUrl(iconUrl); 110 notification->setIconUrl(iconUrl);
108 } 111 }
109 112
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return ScriptValue(scriptState, m_serializedData->deserialize(scriptState->i solate())); 330 return ScriptValue(scriptState, m_serializedData->deserialize(scriptState->i solate()));
328 } 331 }
329 332
330 DEFINE_TRACE(Notification) 333 DEFINE_TRACE(Notification)
331 { 334 {
332 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor); 335 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor);
333 ActiveDOMObject::trace(visitor); 336 ActiveDOMObject::trace(visitor);
334 } 337 }
335 338
336 } // namespace blink 339 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/mediasource/TrackDefault.cpp ('k') | Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698