#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_
#include <map>
#include <string>
#include "base/basictypes.h"
#include "third_party/WebKit/public/web/WebNotification.h"
#include "third_party/WebKit/public/web/WebNotificationPresenter.h"
namespace WebTestRunner {
class WebTestDelegate;
}
namespace content {
class NotificationPresenter : public blink::WebNotificationPresenter {
public:
NotificationPresenter();
virtual ~NotificationPresenter();
void GrantPermission(const std::string& origin, bool permission_granted);
bool SimulateClick(const std::string& title);
void Reset();
void set_delegate(WebTestRunner::WebTestDelegate* delegate) {
delegate_ = delegate;
}
virtual bool show(const blink::WebNotification& notification);
virtual void cancel(const blink::WebNotification& notification);
virtual void objectDestroyed(const blink::WebNotification& notification);
virtual Permission checkPermission(
const blink::WebSecurityOrigin& security_origin);
virtual void requestPermission(
const blink::WebSecurityOrigin& security_origin,
blink::WebNotificationPermissionCallback* callback);
private:
WebTestRunner::WebTestDelegate* delegate_;
typedef std::map<std::string, bool> KnownOriginMap;
KnownOriginMap known_origins_;
typedef std::map<std::string, blink::WebNotification> ActiveNotificationMap;
ActiveNotificationMap active_notifications_;
std::map<std::string, std::string> replacements_;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenter);
};
}
#endif