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