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

Unified Diff: content/shell/browser/layout_test/layout_test_notification_manager.h

Issue 1099943003: Notifications: use LayoutTestPermissionManager to handle permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_midiclientmock
Patch Set: Created 5 years, 8 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/layout_test/layout_test_notification_manager.h
diff --git a/content/shell/browser/layout_test/layout_test_notification_manager.h b/content/shell/browser/layout_test/layout_test_notification_manager.h
index d2cd2f5aad586e19994afbe3d7bf320dc16d115b..ac51c5c368ef552504f65b8cae03c480de269980 100644
--- a/content/shell/browser/layout_test/layout_test_notification_manager.h
+++ b/content/shell/browser/layout_test/layout_test_notification_manager.h
@@ -11,9 +11,7 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/synchronization/lock.h"
#include "content/public/browser/platform_notification_service.h"
-#include "content/public/common/permission_status.mojom.h"
#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
#include "url/gurl.h"
@@ -29,26 +27,6 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
LayoutTestNotificationManager();
~LayoutTestNotificationManager() override;
- // Requests permission for |origin| to display notifications in layout tests.
- // Must be called on the IO thread.
- // Returns whether the permission is granted.
- PermissionStatus RequestPermission(const GURL& origin);
-
- // Checks if |origin| has permission to display notifications. May be called
- // on both the IO and the UI threads.
- blink::WebNotificationPermission CheckPermission(const GURL& origin);
-
- // Similar to CheckPermission() above but returns a PermissionStatus object.
- PermissionStatus GetPermissionStatus(const GURL& origin);
-
- // Sets the permission to display notifications for |origin| to |permission|.
- // Must be called on the IO thread.
- void SetPermission(const GURL& origin,
- blink::WebNotificationPermission permission);
-
- // Clears the currently granted permissions. Must be called on the IO thread.
- void ClearPermissions();
-
// Simulates a click on the notification titled |title|. Must be called on the
// UI thread.
void SimulateClick(const std::string& title);
@@ -79,6 +57,13 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
int64_t persistent_notification_id) override;
private:
+ // Structure to represent the information of a persistent notification.
+ struct PersistentNotification {
+ BrowserContext* browser_context = nullptr;
+ GURL origin;
+ int64_t persistent_id = 0;
+ };
+
// Closes the notification titled |title|. Must be called on the UI thread.
void Close(const std::string& title);
@@ -88,15 +73,9 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
void ReplaceNotificationIfNeeded(
const PlatformNotificationData& notification_data);
- // Structure to represent the information of a persistent notification.
- struct PersistentNotification {
- BrowserContext* browser_context = nullptr;
- GURL origin;
- int64_t persistent_id = 0;
- };
-
- std::map<GURL, blink::WebNotificationPermission> permission_map_;
- base::Lock permission_lock_;
+ // Checks if |origin| has permission to display notifications. May be called
+ // on both the IO and the UI threads.
+ blink::WebNotificationPermission CheckPermission(const GURL& origin);
std::map<std::string, DesktopNotificationDelegate*> page_notifications_;
std::map<std::string, PersistentNotification> persistent_notifications_;

Powered by Google App Engine
This is Rietveld 408576698