OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 // If options's silent is true, and options's vibrate is present, throw a Ty
peError exception. | 82 // If options's silent is true, and options's vibrate is present, throw a Ty
peError exception. |
83 if (options.hasVibrate() && options.silent()) { | 83 if (options.hasVibrate() && options.silent()) { |
84 exceptionState.throwTypeError("Silent notifications must not specify vib
ration patterns."); | 84 exceptionState.throwTypeError("Silent notifications must not specify vib
ration patterns."); |
85 return nullptr; | 85 return nullptr; |
86 } | 86 } |
87 | 87 |
88 RefPtr<SerializedScriptValue> data; | 88 RefPtr<SerializedScriptValue> data; |
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().is
olate(), options.data(), nullptr, exceptionState); |
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 notification->setLang(options.lang()); |
100 notification->setDir(options.dir()); | 100 notification->setDir(options.dir()); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return ScriptValue(scriptState, m_serializedData->deserialize(scriptState->i
solate())); | 327 return ScriptValue(scriptState, m_serializedData->deserialize(scriptState->i
solate())); |
328 } | 328 } |
329 | 329 |
330 DEFINE_TRACE(Notification) | 330 DEFINE_TRACE(Notification) |
331 { | 331 { |
332 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); | 332 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); |
333 ActiveDOMObject::trace(visitor); | 333 ActiveDOMObject::trace(visitor); |
334 } | 334 } |
335 | 335 |
336 } // namespace blink | 336 } // namespace blink |
OLD | NEW |