| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (!client()) { | 61 if (!client()) { |
| 62 exceptionState.throwUninformativeAndGenericDOMException(InvalidState
Error); | 62 exceptionState.throwUninformativeAndGenericDOMException(InvalidState
Error); |
| 63 return 0; | 63 return 0; |
| 64 } | 64 } |
| 65 return WebKitNotification::create(title, body, iconUrl, executionContext
(), exceptionState, this); | 65 return WebKitNotification::create(title, body, iconUrl, executionContext
(), exceptionState, this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 NotificationClient* client() const { return m_client; } | 68 NotificationClient* client() const { return m_client; } |
| 69 | 69 |
| 70 int checkPermission(); | 70 int checkPermission(); |
| 71 void requestPermission(PassRefPtr<VoidCallback> = 0); | 71 void requestPermission(PassOwnPtr<VoidCallback> = nullptr); |
| 72 | 72 |
| 73 virtual void stop() OVERRIDE; | 73 virtual void stop() OVERRIDE; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 NotificationCenter(ExecutionContext*, NotificationClient*); | 76 NotificationCenter(ExecutionContext*, NotificationClient*); |
| 77 | 77 |
| 78 class NotificationRequestCallback : public RefCounted<NotificationRequestCal
lback> { | 78 class NotificationRequestCallback : public RefCounted<NotificationRequestCal
lback> { |
| 79 public: | 79 public: |
| 80 static PassRefPtr<NotificationRequestCallback> createAndStartTimer(Notif
icationCenter*, PassRefPtr<VoidCallback>); | 80 static PassRefPtr<NotificationRequestCallback> createAndStartTimer(Notif
icationCenter*, PassOwnPtr<VoidCallback>); |
| 81 void startTimer(); | 81 void startTimer(); |
| 82 void timerFired(Timer<NotificationRequestCallback>*); | 82 void timerFired(Timer<NotificationRequestCallback>*); |
| 83 private: | 83 private: |
| 84 NotificationRequestCallback(NotificationCenter*, PassRefPtr<VoidCallback
>); | 84 NotificationRequestCallback(NotificationCenter*, PassOwnPtr<VoidCallback
>); |
| 85 | 85 |
| 86 RefPtr<NotificationCenter> m_notificationCenter; | 86 RefPtr<NotificationCenter> m_notificationCenter; |
| 87 Timer<NotificationRequestCallback> m_timer; | 87 Timer<NotificationRequestCallback> m_timer; |
| 88 RefPtr<VoidCallback> m_callback; | 88 OwnPtr<VoidCallback> m_callback; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 void requestTimedOut(NotificationRequestCallback*); | 91 void requestTimedOut(NotificationRequestCallback*); |
| 92 | 92 |
| 93 NotificationClient* m_client; | 93 NotificationClient* m_client; |
| 94 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks; | 94 HashSet<RefPtr<NotificationRequestCallback> > m_callbacks; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace WebCore | 97 } // namespace WebCore |
| 98 | 98 |
| 99 #endif // ENABLE(LEGACY_NOTIFICATIONS) | 99 #endif // ENABLE(LEGACY_NOTIFICATIONS) |
| 100 | 100 |
| 101 #endif // NotificationCenter_h | 101 #endif // NotificationCenter_h |
| OLD | NEW |