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