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

Unified Diff: chrome/browser/content_settings/permission_observer.h

Issue 990303002: Implement PermissionService::GetNextPermissionChange. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission_impl
Patch Set: review comments Created 5 years, 9 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: chrome/browser/content_settings/permission_observer.h
diff --git a/chrome/browser/content_settings/permission_observer.h b/chrome/browser/content_settings/permission_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..4713c287239e52537d90cb558a15b72421495d34
--- /dev/null
+++ b/chrome/browser/content_settings/permission_observer.h
@@ -0,0 +1,47 @@
+// Copyright 2015 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 CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_
+#define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_
+
+#include "base/callback.h"
+#include "base/id_map.h"
+#include "base/macros.h"
+#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/common/content_settings.h"
+#include "components/keyed_service/core/keyed_service.h"
+
+class Profile;
+
+class PermissionObserver : public KeyedService,
+ public content_settings::Observer {
+ public:
+ using PermissionChangeCallback = base::Callback<void(ContentSetting)>;
+
+ explicit PermissionObserver(Profile* profile);
+ ~PermissionObserver() override;
+
+ int Subscribe(ContentSettingsType content_type,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin,
+ const PermissionChangeCallback& callback);
+ void Unsubscribe(int subscription_id);
+
+ private:
+ struct Subscription;
+ using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
+
+ // content_settings::Observer implementation.
+ void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ std::string resource_identifier) override;
+
+ Profile* profile_;
+ SubscriptionsMap subscriptions_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionObserver);
+};
+
+#endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698