OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ | |
6 #define WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ | |
7 | |
8 #include <map> | |
9 #include <set> | |
10 #include <string> | |
11 | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" | |
13 #include "webkit/tools/test_shell/test_shell.h" | |
14 | |
15 // A class that implements NotificationPresenter for the test shell. | |
16 class TestNotificationPresenter : public WebKit::WebNotificationPresenter { | |
17 public: | |
18 explicit TestNotificationPresenter(TestShell* shell); | |
19 virtual ~TestNotificationPresenter(); | |
20 | |
21 void Reset(); | |
22 | |
23 // Called by the testRunner to simulate a user granting | |
24 // permission. | |
25 void grantPermission(const std::string& origin); | |
26 | |
27 // WebKit::WebNotificationPresenter interface | |
28 virtual bool show(const WebKit::WebNotification&); | |
29 virtual void cancel(const WebKit::WebNotification&); | |
30 virtual void objectDestroyed(const WebKit::WebNotification&); | |
31 virtual Permission checkPermission(const WebKit::WebSecurityOrigin& origin); | |
32 virtual void requestPermission(const WebKit::WebSecurityOrigin& origin, | |
33 WebKit::WebNotificationPermissionCallback* callback); | |
34 | |
35 private: | |
36 // List of allowed origins. | |
37 std::set<std::string> allowed_origins_; | |
38 | |
39 // Map of active replacement IDs to the titles of those notifications | |
40 std::map<std::string, std::string> replacements_; | |
41 }; | |
42 | |
43 #endif // WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ | |
OLD | NEW |