| 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_
|
|
|