Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / permissions / permission_manager.h
blob044dfcda5a964765cc7a6a1ff6b7c9deba9affce
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.
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
8 #include "base/callback_forward.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/keyed_service/core/keyed_service.h"
13 #include "content/public/browser/permission_manager.h"
16 class Profile;
18 namespace content {
19 enum class PermissionType;
20 }; // namespace content
22 class PermissionManager : public KeyedService,
23 public content::PermissionManager,
24 public content_settings::Observer {
25 public:
26 explicit PermissionManager(Profile* profile);
27 ~PermissionManager() override;
29 // content::PermissionManager implementation.
30 void RequestPermission(
31 content::PermissionType permission,
32 content::RenderFrameHost* render_frame_host,
33 int request_id,
34 const GURL& requesting_origin,
35 bool user_gesture,
36 const base::Callback<void(content::PermissionStatus)>& callback) override;
37 void CancelPermissionRequest(content::PermissionType permission,
38 content::RenderFrameHost* render_frame_host,
39 int request_id,
40 const GURL& requesting_origin) override;
41 void ResetPermission(content::PermissionType permission,
42 const GURL& requesting_origin,
43 const GURL& embedding_origin) override;
44 content::PermissionStatus GetPermissionStatus(
45 content::PermissionType permission,
46 const GURL& requesting_origin,
47 const GURL& embedding_origin) override;
48 void RegisterPermissionUsage(content::PermissionType permission,
49 const GURL& requesting_origin,
50 const GURL& embedding_origin) override;
51 int SubscribePermissionStatusChange(
52 content::PermissionType permission,
53 const GURL& requesting_origin,
54 const GURL& embedding_origin,
55 const base::Callback<void(content::PermissionStatus)>& callback) override;
56 void UnsubscribePermissionStatusChange(int subscription_id) override;
58 private:
59 struct Subscription;
60 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
62 // content_settings::Observer implementation.
63 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
64 const ContentSettingsPattern& secondary_pattern,
65 ContentSettingsType content_type,
66 std::string resource_identifier) override;
68 Profile* profile_;
69 SubscriptionsMap subscriptions_;
71 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
74 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_