Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: content/shell/browser/shell_notification_manager.h

Issue 395883002: Support layout testing Web Notifications from Document and Worker contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_notification_manager.h
diff --git a/content/shell/browser/shell_notification_manager.h b/content/shell/browser/shell_notification_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..53641843ead4473061dfd4d3df9318f473458b7a
--- /dev/null
+++ b/content/shell/browser/shell_notification_manager.h
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_SHELL_BROWSER_SHELL_NOTIFICATION_MANAGER_H_
+#define CONTENT_SHELL_BROWSER_SHELL_NOTIFICATION_MANAGER_H_
+
+#include <map>
+
+#include "base/callback.h"
+#include "third_party/WebKit/public/web/WebNotificationPresenter.h"
+#include "url/gurl.h"
+
+namespace content {
+
+// Responsible for tracking active notifications and allowed origins for the
+// Web Notification API when running layout tests.
+class ShellNotificationManager {
+ public:
+ ShellNotificationManager();
+ ~ShellNotificationManager();
+
+ // Checks whether |origin| has permission to display notifications in tests.
+ blink::WebNotificationPresenter::Permission CheckPermission(
+ const GURL& origin);
+
+ // Requests permission for |origin| to display notifications in layout tests.
+ void RequestPermission(const GURL& origin,
+ const base::Closure& callback);
+
+ // Sets the permission to display notifications for |origin| to |permission|.
+ void SetPermission(const GURL& origin,
+ blink::WebNotificationPresenter::Permission permission);
+
+ // Clears the currently granted permissions.
+ void ClearPermissions();
+
+ private:
+ typedef std::map<GURL, blink::WebNotificationPresenter::Permission>
+ NotificationPermissionMap;
+ NotificationPermissionMap permission_map_;
+};
jochen (gone - plz use gerrit) 2014/07/17 09:29:45 disallow copy/assign
Peter Beverloo 2014/07/17 12:22:53 Done.
+
+} // content
+
+#endif // CONTENT_SHELL_BROWSER_SHELL_NOTIFICATION_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698