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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_
7
8 #include "base/callback.h"
9 #include "base/id_map.h"
10 #include "base/macros.h"
11 #include "components/content_settings/core/browser/content_settings_observer.h"
12 #include "components/content_settings/core/common/content_settings.h"
13 #include "components/keyed_service/core/keyed_service.h"
14
15 class Profile;
16
17 class PermissionObserver : public KeyedService,
18 public content_settings::Observer {
19 public:
20 using PermissionChangeCallback = base::Callback<void(ContentSetting)>;
21
22 explicit PermissionObserver(Profile* profile);
23 ~PermissionObserver() override;
24
25 int Subscribe(ContentSettingsType content_type,
26 const GURL& requesting_origin,
27 const GURL& embedding_origin,
28 const PermissionChangeCallback& callback);
29 void Unsubscribe(int subscription_id);
30
31 private:
32 struct Subscription;
33 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
34
35 // content_settings::Observer implementation.
36 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
37 const ContentSettingsPattern& secondary_pattern,
38 ContentSettingsType content_type,
39 std::string resource_identifier) override;
40
41 Profile* profile_;
42 SubscriptionsMap subscriptions_;
43
44 DISALLOW_COPY_AND_ASSIGN(PermissionObserver);
45 };
46
47 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698