OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 PassRefPtr<Notification> createHTMLNotification(const String& URI, Excep
tionCode& ec) | 51 PassRefPtr<Notification> createHTMLNotification(const String& URI, Excep
tionCode& ec) |
52 { | 52 { |
53 if (!presenter()) { | 53 if (!presenter()) { |
54 ec = INVALID_STATE_ERR; | 54 ec = INVALID_STATE_ERR; |
55 return 0; | 55 return 0; |
56 } | 56 } |
57 if (URI.isEmpty()) { | 57 if (URI.isEmpty()) { |
58 ec = SYNTAX_ERR; | 58 ec = SYNTAX_ERR; |
59 return 0; | 59 return 0; |
60 } | 60 } |
61 return Notification::create(m_scriptExecutionContext->completeURL(UR
I), context(), ec, this); | 61 return Notification::create(scriptExecutionContext()->completeURL(UR
I), scriptExecutionContext(), ec, this); |
62 } | 62 } |
63 | 63 |
64 PassRefPtr<Notification> createNotification(const String& iconURI, const
String& title, const String& body, ExceptionCode& ec) | 64 PassRefPtr<Notification> createNotification(const String& iconURI, const
String& title, const String& body, ExceptionCode& ec) |
65 { | 65 { |
66 if (!presenter()) { | 66 if (!presenter()) { |
67 ec = INVALID_STATE_ERR; | 67 ec = INVALID_STATE_ERR; |
68 return 0; | 68 return 0; |
69 } | 69 } |
70 NotificationContents contents(iconURI.isEmpty() ? KURL() : m_scriptE
xecutionContext->completeURL(iconURI), title, body); | 70 NotificationContents contents(iconURI.isEmpty() ? KURL() : scriptExe
cutionContext()->completeURL(iconURI), title, body); |
71 return Notification::create(contents, context(), ec, this); | 71 return Notification::create(contents, scriptExecutionContext(), ec,
this); |
72 } | 72 } |
73 | 73 |
74 ScriptExecutionContext* context() const { return m_scriptExecutionContex
t; } | |
75 NotificationPresenter* presenter() const { return m_notificationPresente
r; } | 74 NotificationPresenter* presenter() const { return m_notificationPresente
r; } |
76 | 75 |
77 int checkPermission(); | 76 int checkPermission(); |
78 void requestPermission(PassRefPtr<VoidCallback> callback); | 77 void requestPermission(PassRefPtr<VoidCallback> callback); |
79 | 78 |
80 void disconnectFrame(); | 79 void disconnectFrame(); |
81 | 80 |
82 private: | 81 private: |
83 NotificationCenter(ScriptExecutionContext*, NotificationPresenter*); | 82 NotificationCenter(ScriptExecutionContext*, NotificationPresenter*); |
84 | 83 |
85 ScriptExecutionContext* m_scriptExecutionContext; | |
86 NotificationPresenter* m_notificationPresenter; | 84 NotificationPresenter* m_notificationPresenter; |
87 }; | 85 }; |
88 | 86 |
89 } // namespace WebCore | 87 } // namespace WebCore |
90 | 88 |
91 #endif // ENABLE(NOTIFICATIONS) | 89 #endif // ENABLE(NOTIFICATIONS) |
92 | 90 |
93 #endif // NotificationCenter_h | 91 #endif // NotificationCenter_h |
OLD | NEW |