Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / public / browser / permission_manager.h
blob6a56e0b6a58b7be2cf05246d4e8371e7d766711b
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 CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
6 #define CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
8 #include "content/common/content_export.h"
9 #include "content/public/common/permission_status.mojom.h"
11 class GURL;
13 namespace content {
14 enum class PermissionType;
15 class WebContents;
17 class CONTENT_EXPORT PermissionManager {
18 public:
19 virtual ~PermissionManager() = default;
21 virtual void RequestPermission(
22 PermissionType permission,
23 WebContents* web_contents,
24 int request_id,
25 const GURL& requesting_origin,
26 bool user_gesture,
27 const base::Callback<void(PermissionStatus)>& callback) = 0;
29 virtual void CancelPermissionRequest(PermissionType permission,
30 WebContents* web_contents,
31 int request_id,
32 const GURL& requesting_origin) = 0;
34 virtual PermissionStatus GetPermissionStatus(
35 PermissionType permission,
36 const GURL& requesting_origin,
37 const GURL& embedding_origin) = 0;
39 virtual void ResetPermission(PermissionType permission,
40 const GURL& requesting_origin,
41 const GURL& embedding_origin) = 0;
43 virtual void RegisterPermissionUsage(PermissionType permission,
44 const GURL& requesting_origin,
45 const GURL& embedding_origin) = 0;
47 // Runs the given |callback| whenever the |permission| associated with the
48 // pair { requesting_origin, embedding_origin } changes.
49 // Returns the subscription_id to be used to unsubscribe.
50 virtual int SubscribePermissionStatusChange(
51 PermissionType permission,
52 const GURL& requesting_origin,
53 const GURL& embedding_origin,
54 const base::Callback<void(PermissionStatus)>& callback) = 0;
56 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0;
59 } // namespace content
61 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_