OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 <set> |
| 9 #include <string> |
| 10 |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" |
| 12 #include "webkit/tools/test_shell/test_shell.h" |
| 13 |
| 14 // A class that implements NotificationPresenter for the test shell. |
| 15 class TestNotificationPresenter : public WebKit::WebNotificationPresenter { |
| 16 public: |
| 17 explicit TestNotificationPresenter(TestShell* shell) |
| 18 : shell_(shell) { |
| 19 } |
| 20 |
| 21 // Called by the LayoutTestController to simulate a user granting |
| 22 // permission. |
| 23 void grantPermission(const std::string& origin); |
| 24 |
| 25 // WebKit::WebNotificationPresenter interface |
| 26 virtual bool show(const WebKit::WebNotification&); |
| 27 virtual void cancel(const WebKit::WebNotification&); |
| 28 virtual void objectDestroyed(const WebKit::WebNotification&); |
| 29 virtual Permission checkPermission(const WebKit::WebURL& url); |
| 30 virtual void requestPermission(const WebKit::WebSecurityOrigin& origin, |
| 31 WebKit::WebNotificationPermissionCallback* callback); |
| 32 |
| 33 void Reset() { |
| 34 allowed_origins_.clear(); |
| 35 } |
| 36 |
| 37 private: |
| 38 // Non-owned pointer. The NotificationPresenter is owned by the test shell. |
| 39 TestShell* shell_; |
| 40 |
| 41 // List of allowed origins. |
| 42 std::set<std::string> allowed_origins_; |
| 43 }; |
| 44 |
| 45 #endif // WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ |
OLD | NEW |