OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // A class that implements WebNotificationPresenter for the TestRunner library. | 44 // A class that implements WebNotificationPresenter for the TestRunner library. |
45 class NotificationPresenter : public WebKit::WebNotificationPresenter { | 45 class NotificationPresenter : public WebKit::WebNotificationPresenter { |
46 public: | 46 public: |
47 NotificationPresenter(); | 47 NotificationPresenter(); |
48 virtual ~NotificationPresenter(); | 48 virtual ~NotificationPresenter(); |
49 | 49 |
50 void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; } | 50 void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; } |
51 | 51 |
52 // Called by the TestRunner to simulate a user granting permission. | 52 // Called by the TestRunner to simulate a user granting permission. |
53 void grantPermission(const WebKit::WebString& origin); | 53 void grantPermission(const WebKit::WebString& origin); |
| 54 void removeAllWebNotificationPermissions() { m_allowedOrigins.clear(); } |
54 | 55 |
55 // Called by the TestRunner to simulate a user clicking on a notification. | 56 // Called by the TestRunner to simulate a user clicking on a notification. |
56 bool simulateClick(const WebKit::WebString& notificationIdentifier); | 57 bool simulateClick(const WebKit::WebString& notificationIdentifier); |
57 | 58 |
58 // WebKit::WebNotificationPresenter interface | 59 // WebKit::WebNotificationPresenter interface |
59 virtual bool show(const WebKit::WebNotification&); | 60 virtual bool show(const WebKit::WebNotification&); |
60 virtual void cancel(const WebKit::WebNotification&); | 61 virtual void cancel(const WebKit::WebNotification&); |
61 virtual void objectDestroyed(const WebKit::WebNotification&); | 62 virtual void objectDestroyed(const WebKit::WebNotification&); |
62 virtual Permission checkPermission(const WebKit::WebSecurityOrigin&); | 63 virtual Permission checkPermission(const WebKit::WebSecurityOrigin&); |
63 virtual void requestPermission(const WebKit::WebSecurityOrigin&, WebKit::Web
NotificationPermissionCallback*); | 64 virtual void requestPermission(const WebKit::WebSecurityOrigin&, WebKit::Web
NotificationPermissionCallback*); |
64 | 65 |
65 void reset() { m_allowedOrigins.clear(); } | 66 void reset() { m_allowedOrigins.clear(); } |
66 | 67 |
67 private: | 68 private: |
68 WebTestDelegate* m_delegate; | 69 WebTestDelegate* m_delegate; |
69 | 70 |
70 // Set of allowed origins. | 71 // Set of allowed origins. |
71 std::set<std::string> m_allowedOrigins; | 72 std::set<std::string> m_allowedOrigins; |
72 | 73 |
73 // Map of active notifications. | 74 // Map of active notifications. |
74 std::map<std::string, WebKit::WebNotification> m_activeNotifications; | 75 std::map<std::string, WebKit::WebNotification> m_activeNotifications; |
75 | 76 |
76 // Map of active replacement IDs to the titles of those notifications | 77 // Map of active replacement IDs to the titles of those notifications |
77 std::map<std::string, std::string> m_replacements; | 78 std::map<std::string, std::string> m_replacements; |
78 }; | 79 }; |
79 | 80 |
80 } | 81 } |
81 | 82 |
82 #endif // NotificationPresenter_h | 83 #endif // NotificationPresenter_h |
OLD | NEW |