| 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 26 matching lines...) Expand all Loading... |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class ExecutionContext; | 41 class ExecutionContext; |
| 42 class Notification; | 42 class Notification; |
| 43 | 43 |
| 44 class NotificationClient { | 44 class NotificationClient { |
| 45 | 45 |
| 46 public: | 46 public: |
| 47 virtual ~NotificationClient() { } |
| 48 |
| 47 enum Permission { | 49 enum Permission { |
| 48 PermissionAllowed, // User has allowed notifications | 50 PermissionAllowed, // User has allowed notifications |
| 49 PermissionNotAllowed, // User has not yet allowed | 51 PermissionNotAllowed, // User has not yet allowed |
| 50 PermissionDenied // User has explicitly denied permission | 52 PermissionDenied // User has explicitly denied permission |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 // Requests that a notification be shown. | 55 // Requests that a notification be shown. |
| 54 virtual bool show(Notification*) = 0; | 56 virtual bool show(Notification*) = 0; |
| 55 | 57 |
| 56 // Requests that a notification that has already been shown be closed. | 58 // Requests that a notification that has already been shown be closed. |
| 57 virtual void close(Notification*) = 0; | 59 virtual void close(Notification*) = 0; |
| 58 | 60 |
| 59 // Informs the presenter that a Notification object has been destroyed | 61 // Informs the presenter that a Notification object has been destroyed |
| 60 // (such as by a page transition). The presenter may continue showing | 62 // (such as by a page transition). The presenter may continue showing |
| 61 // the notification, but must not attempt to call the event handlers. | 63 // the notification, but must not attempt to call the event handlers. |
| 62 virtual void notificationObjectDestroyed(Notification*) = 0; | 64 virtual void notificationObjectDestroyed(Notification*) = 0; |
| 63 | 65 |
| 64 // Requests user permission to show desktop notifications from a particular | 66 // Requests user permission to show desktop notifications from a particular |
| 65 // script context. The callback parameter should be run when the user has | 67 // script context. The callback parameter should be run when the user has |
| 66 // made a decision. | 68 // made a decision. |
| 67 virtual void requestPermission(ExecutionContext*, PassOwnPtr<NotificationPer
missionCallback>) = 0; | 69 virtual void requestPermission(ExecutionContext*, PassOwnPtr<NotificationPer
missionCallback>) = 0; |
| 68 | 70 |
| 69 // Checks the current level of permission. | 71 // Checks the current level of permission. |
| 70 virtual Permission checkPermission(ExecutionContext*) = 0; | 72 virtual Permission checkPermission(ExecutionContext*) = 0; |
| 71 | |
| 72 protected: | |
| 73 virtual ~NotificationClient() { } | |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace WebCore | 75 } // namespace WebCore |
| 77 | 76 |
| 78 #endif // NotificationClient_h | 77 #endif // NotificationClient_h |
| OLD | NEW |