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) 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class VoidCallback; | 51 class VoidCallback; |
52 | 52 |
53 class NotificationCenter : public RefCounted<NotificationCenter>, public ScriptW
rappable, public ActiveDOMObject { | 53 class NotificationCenter : public RefCounted<NotificationCenter>, public ScriptW
rappable, public ActiveDOMObject { |
54 public: | 54 public: |
55 static PassRefPtr<NotificationCenter> create(ScriptExecutionContext*, Notifi
cationClient*); | 55 static PassRefPtr<NotificationCenter> create(ScriptExecutionContext*, Notifi
cationClient*); |
56 | 56 |
57 #if ENABLE(LEGACY_NOTIFICATIONS) | 57 #if ENABLE(LEGACY_NOTIFICATIONS) |
58 PassRefPtr<Notification> createHTMLNotification(const String& URI, Exception
Code& ec) | 58 PassRefPtr<Notification> createHTMLNotification(const String& URI, Exception
Code& ec) |
59 { | 59 { |
60 if (!client()) { | 60 if (!client()) { |
61 ec = INVALID_STATE_ERR; | 61 ec = InvalidStateError; |
62 return 0; | 62 return 0; |
63 } | 63 } |
64 if (URI.isEmpty()) { | 64 if (URI.isEmpty()) { |
65 ec = SYNTAX_ERR; | 65 ec = SyntaxError; |
66 return 0; | 66 return 0; |
67 } | 67 } |
68 return Notification::create(scriptExecutionContext()->completeURL(URI),
scriptExecutionContext(), ec, this); | 68 return Notification::create(scriptExecutionContext()->completeURL(URI),
scriptExecutionContext(), ec, this); |
69 } | 69 } |
70 #endif | 70 #endif |
71 | 71 |
72 #if ENABLE(LEGACY_NOTIFICATIONS) | 72 #if ENABLE(LEGACY_NOTIFICATIONS) |
73 PassRefPtr<Notification> createNotification(const String& iconURI, const Str
ing& title, const String& body, ExceptionCode& ec) | 73 PassRefPtr<Notification> createNotification(const String& iconURI, const Str
ing& title, const String& body, ExceptionCode& ec) |
74 { | 74 { |
75 if (!client()) { | 75 if (!client()) { |
76 ec = INVALID_STATE_ERR; | 76 ec = InvalidStateError; |
77 return 0; | 77 return 0; |
78 } | 78 } |
79 return Notification::create(title, body, iconURI, scriptExecutionContext
(), ec, this); | 79 return Notification::create(title, body, iconURI, scriptExecutionContext
(), ec, this); |
80 } | 80 } |
81 #endif | 81 #endif |
82 | 82 |
83 NotificationClient* client() const { return m_client; } | 83 NotificationClient* client() const { return m_client; } |
84 | 84 |
85 #if ENABLE(LEGACY_NOTIFICATIONS) | 85 #if ENABLE(LEGACY_NOTIFICATIONS) |
86 int checkPermission(); | 86 int checkPermission(); |
(...skipping 22 matching lines...) Expand all Loading... |
109 | 109 |
110 NotificationClient* m_client; | 110 NotificationClient* m_client; |
111 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks; | 111 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks; |
112 }; | 112 }; |
113 | 113 |
114 } // namespace WebCore | 114 } // namespace WebCore |
115 | 115 |
116 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) | 116 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) |
117 | 117 |
118 #endif // NotificationCenter_h | 118 #endif // NotificationCenter_h |
OLD | NEW |