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

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

Issue 1101153002: LayoutTestPermissionManager: implement subscriptions handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_calls
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
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_permission_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/layout_test/layout_test_permission_manager.h
diff --git a/content/shell/browser/layout_test/layout_test_permission_manager.h b/content/shell/browser/layout_test/layout_test_permission_manager.h
index 9c0461f7788d6aa3f6a8a70f9a36408dd6ba40cc..8aa905e23623267b365aaeda0f08d3e7b9b4fd92 100644
--- a/content/shell/browser/layout_test/layout_test_permission_manager.h
+++ b/content/shell/browser/layout_test/layout_test_permission_manager.h
@@ -7,6 +7,7 @@
#include "base/callback_forward.h"
#include "base/containers/hash_tables.h"
+#include "base/id_map.h"
#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/permission_manager.h"
@@ -56,10 +57,12 @@ class LayoutTestPermissionManager : public PermissionManager {
private:
// Representation of a permission for the LayoutTestPermissionManager.
struct PermissionDescription {
+ PermissionDescription() = default;
PermissionDescription(PermissionType type,
const GURL& origin,
const GURL& embedding_origin);
bool operator==(const PermissionDescription& other) const;
+ bool operator!=(const PermissionDescription& other) const;
// Hash operator for hash maps.
struct Hash {
@@ -71,10 +74,15 @@ class LayoutTestPermissionManager : public PermissionManager {
GURL embedding_origin;
};
+ struct Subscription;
+ using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
using PermissionsMap = base::hash_map<PermissionDescription,
PermissionStatus,
PermissionDescription::Hash>;
+ void OnPermissionChanged(const PermissionDescription& permission,
+ PermissionStatus status);
+
// Mutex for permissions access. Unfortunately, the permissions can be
// accessed from the IO thread because of Notifications' synchronous IPC.
base::Lock permissions_lock_;
@@ -83,6 +91,9 @@ class LayoutTestPermissionManager : public PermissionManager {
// their associated |PermissionStatus|.
PermissionsMap permissions_;
+ // List of subscribers currently listening to permission changes.
+ SubscriptionsMap subscriptions_;
+
DISALLOW_COPY_AND_ASSIGN(LayoutTestPermissionManager);
};
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_permission_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698