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

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: another rebase 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
« no previous file with comments | « content/shell/browser/shell_message_filter.cc ('k') | content/shell/browser/shell_notification_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7520d15e67829d01938134ba6c7800efd4cb9786
--- /dev/null
+++ b/content/shell/browser/shell_notification_manager.h
@@ -0,0 +1,50 @@
+// 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/platform/WebNotificationPermission.h"
+#include "url/gurl.h"
+
+namespace content {
+
+// Responsible for tracking active notifications and allowed origins for the
+// Web Notification API when running layout tests. The methods in this class
+// should only be used on the IO thread.
+class ShellNotificationManager {
+ public:
+ ShellNotificationManager();
+ ~ShellNotificationManager();
+
+ // Checks whether |origin| has permission to display notifications in tests.
+ blink::WebNotificationPermission CheckPermission(
+ const GURL& origin);
+
+ // Requests permission for |origin| to display notifications in layout tests.
+ void RequestPermission(
+ const GURL& origin,
+ const base::Callback<void(blink::WebNotificationPermission)>& callback);
+
+ // Sets the permission to display notifications for |origin| to |permission|.
+ void SetPermission(const GURL& origin,
+ blink::WebNotificationPermission permission);
+
+ // Clears the currently granted permissions.
+ void ClearPermissions();
+
+ private:
+ typedef std::map<GURL, blink::WebNotificationPermission>
+ NotificationPermissionMap;
+ NotificationPermissionMap permission_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShellNotificationManager);
+};
+
+} // content
+
+#endif // CONTENT_SHELL_BROWSER_SHELL_NOTIFICATION_MANAGER_H_
« no previous file with comments | « content/shell/browser/shell_message_filter.cc ('k') | content/shell/browser/shell_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698