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

Side by Side Diff: content/public/browser/permission_manager.h

Issue 1942353002: (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « content/public/browser/BUILD.gn ('k') | content/public/browser/platform_notification_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
6 #define CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ 6 #define CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
7 7
8 #include "components/permissions/permission_status.mojom.h"
8 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
9 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
10 10
11 class GURL; 11 class GURL;
12 12
13 namespace content { 13 namespace content {
14 enum class PermissionType; 14 enum class PermissionType;
15 class RenderFrameHost; 15 class RenderFrameHost;
16 16
17 // This class allows the content layer to manipulate permissions. It has to be 17 // This class allows the content layer to manipulate permissions. It has to be
18 // implemented by the embedder which ultimately handles the permission 18 // implemented by the embedder which ultimately handles the permission
19 // management for the content layer. 19 // management for the content layer.
(...skipping 10 matching lines...) Expand all
30 // When the permission request is handled, whether it failed, timed out or 30 // When the permission request is handled, whether it failed, timed out or
31 // succeeded, the |callback| will be run. 31 // succeeded, the |callback| will be run.
32 // Returns a request id which can be used to cancel the permission (see 32 // Returns a request id which can be used to cancel the permission (see
33 // CancelPermissionRequest). This can be kNoPendingOperation if 33 // CancelPermissionRequest). This can be kNoPendingOperation if
34 // there is no further need to cancel the permission in which case |callback| 34 // there is no further need to cancel the permission in which case |callback|
35 // was invoked. 35 // was invoked.
36 virtual int RequestPermission( 36 virtual int RequestPermission(
37 PermissionType permission, 37 PermissionType permission,
38 RenderFrameHost* render_frame_host, 38 RenderFrameHost* render_frame_host,
39 const GURL& requesting_origin, 39 const GURL& requesting_origin,
40 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) = 0; 40 const base::Callback<void(permissions::mojom::PermissionStatus)>&
41 callback) = 0;
41 42
42 // Requests multiple permissions on behalf of a frame identified by 43 // Requests multiple permissions on behalf of a frame identified by
43 // render_frame_host. 44 // render_frame_host.
44 // When the permission request is handled, whether it failed, timed out or 45 // When the permission request is handled, whether it failed, timed out or
45 // succeeded, the |callback| will be run. The order of statuses in the 46 // succeeded, the |callback| will be run. The order of statuses in the
46 // returned vector will correspond to the order of requested permission 47 // returned vector will correspond to the order of requested permission
47 // types. 48 // types.
48 // Returns a request id which can be used to cancel the request (see 49 // Returns a request id which can be used to cancel the request (see
49 // CancelPermissionRequest). This can be kNoPendingOperation if 50 // CancelPermissionRequest). This can be kNoPendingOperation if
50 // there is no further need to cancel the permission in which case |callback| 51 // there is no further need to cancel the permission in which case |callback|
51 // was invoked. 52 // was invoked.
52 virtual int RequestPermissions( 53 virtual int RequestPermissions(
53 const std::vector<PermissionType>& permission, 54 const std::vector<PermissionType>& permission,
54 RenderFrameHost* render_frame_host, 55 RenderFrameHost* render_frame_host,
55 const GURL& requesting_origin, 56 const GURL& requesting_origin,
56 const base::Callback<void( 57 const base::Callback<
57 const std::vector<blink::mojom::PermissionStatus>&)>& callback) = 0; 58 void(const std::vector<permissions::mojom::PermissionStatus>&)>&
59 callback) = 0;
58 60
59 // Cancels a previous permission request specified by |request_id|. Cancelling 61 // Cancels a previous permission request specified by |request_id|. Cancelling
60 // an already cancelled request or providing the |request_id| 62 // an already cancelled request or providing the |request_id|
61 // kNoPendingOperation is a no-op. 63 // kNoPendingOperation is a no-op.
62 virtual void CancelPermissionRequest(int request_id) = 0; 64 virtual void CancelPermissionRequest(int request_id) = 0;
63 65
64 // Returns the permission status of a given requesting_origin/embedding_origin 66 // Returns the permission status of a given requesting_origin/embedding_origin
65 // tuple. This is not taking a RenderFrameHost because the call might happen 67 // tuple. This is not taking a RenderFrameHost because the call might happen
66 // outside of a frame context. 68 // outside of a frame context.
67 virtual blink::mojom::PermissionStatus GetPermissionStatus( 69 virtual permissions::mojom::PermissionStatus GetPermissionStatus(
68 PermissionType permission, 70 PermissionType permission,
69 const GURL& requesting_origin, 71 const GURL& requesting_origin,
70 const GURL& embedding_origin) = 0; 72 const GURL& embedding_origin) = 0;
71 73
72 // Sets the permission back to its default for the requesting_origin/ 74 // Sets the permission back to its default for the requesting_origin/
73 // embedding_origin tuple. 75 // embedding_origin tuple.
74 virtual void ResetPermission(PermissionType permission, 76 virtual void ResetPermission(PermissionType permission,
75 const GURL& requesting_origin, 77 const GURL& requesting_origin,
76 const GURL& embedding_origin) = 0; 78 const GURL& embedding_origin) = 0;
77 79
78 // Registers a permission usage. 80 // Registers a permission usage.
79 // TODO(mlamouri): see if we can remove this from the PermissionManager. 81 // TODO(mlamouri): see if we can remove this from the PermissionManager.
80 virtual void RegisterPermissionUsage(PermissionType permission, 82 virtual void RegisterPermissionUsage(PermissionType permission,
81 const GURL& requesting_origin, 83 const GURL& requesting_origin,
82 const GURL& embedding_origin) = 0; 84 const GURL& embedding_origin) = 0;
83 85
84 // Runs the given |callback| whenever the |permission| associated with the 86 // Runs the given |callback| whenever the |permission| associated with the
85 // pair { requesting_origin, embedding_origin } changes. 87 // pair { requesting_origin, embedding_origin } changes.
86 // Returns the subscription_id to be used to unsubscribe. Can be 88 // Returns the subscription_id to be used to unsubscribe. Can be
87 // kNoPendingOperation if the subscribe was not successful. 89 // kNoPendingOperation if the subscribe was not successful.
88 virtual int SubscribePermissionStatusChange( 90 virtual int SubscribePermissionStatusChange(
89 PermissionType permission, 91 PermissionType permission,
90 const GURL& requesting_origin, 92 const GURL& requesting_origin,
91 const GURL& embedding_origin, 93 const GURL& embedding_origin,
92 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) = 0; 94 const base::Callback<void(permissions::mojom::PermissionStatus)>&
95 callback) = 0;
93 96
94 // Unregisters from permission status change notifications. 97 // Unregisters from permission status change notifications.
95 // The |subscription_id| must match the value returned by the 98 // The |subscription_id| must match the value returned by the
96 // SubscribePermissionStatusChange call. Unsubscribing 99 // SubscribePermissionStatusChange call. Unsubscribing
97 // an already unsubscribed |subscription_id| or providing the 100 // an already unsubscribed |subscription_id| or providing the
98 // |subscription_id| kNoPendingOperation is a no-op. 101 // |subscription_id| kNoPendingOperation is a no-op.
99 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0; 102 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0;
100 }; 103 };
101 104
102 } // namespace content 105 } // namespace content
103 106
104 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ 107 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
OLDNEW
« no previous file with comments | « content/public/browser/BUILD.gn ('k') | content/public/browser/platform_notification_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698