OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "modules/notifications/Notification.h" | 33 #include "modules/notifications/Notification.h" |
34 | 34 |
35 #include "bindings/v8/Dictionary.h" | 35 #include "bindings/v8/Dictionary.h" |
36 #include "bindings/v8/ScriptWrappable.h" | 36 #include "bindings/v8/ScriptWrappable.h" |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/ExecutionContext.h" | 38 #include "core/dom/ExecutionContext.h" |
39 #include "modules/notifications/NotificationController.h" | 39 #include "modules/notifications/NotificationController.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 DEFINE_GC_INFO(Notification); | |
44 | |
45 PassRefPtrWillBeRawPtr<Notification> Notification::create(ExecutionContext* cont
ext, const String& title, const Dictionary& options) | 43 PassRefPtrWillBeRawPtr<Notification> Notification::create(ExecutionContext* cont
ext, const String& title, const Dictionary& options) |
46 { | 44 { |
47 NotificationClient* client = NotificationController::clientFrom(toDocument(c
ontext)->page()); | 45 NotificationClient* client = NotificationController::clientFrom(toDocument(c
ontext)->page()); |
48 RefPtrWillBeRawPtr<Notification> notification = adoptRefCountedWillBeRefCoun
tedGarbageCollected(new Notification(context, title, client)); | 46 RefPtrWillBeRawPtr<Notification> notification = adoptRefCountedWillBeRefCoun
tedGarbageCollected(new Notification(context, title, client)); |
49 | 47 |
50 String argument; | 48 String argument; |
51 if (options.get("body", argument)) | 49 if (options.get("body", argument)) |
52 notification->setBody(argument); | 50 notification->setBody(argument); |
53 if (options.get("tag", argument)) | 51 if (options.get("tag", argument)) |
54 notification->setTag(argument); | 52 notification->setTag(argument); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return NotificationBase::hasPendingActivity() || (m_asyncRunner && m_asyncRu
nner->isActive()); | 106 return NotificationBase::hasPendingActivity() || (m_asyncRunner && m_asyncRu
nner->isActive()); |
109 } | 107 } |
110 | 108 |
111 void Notification::showSoon() | 109 void Notification::showSoon() |
112 { | 110 { |
113 ASSERT(executionContext()->isDocument()); | 111 ASSERT(executionContext()->isDocument()); |
114 show(); | 112 show(); |
115 } | 113 } |
116 | 114 |
117 } // namespace WebCore | 115 } // namespace WebCore |
OLD | NEW |