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

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

Issue 2908133003: Split GetPermissionStatus into GetPermissionStatusForFrame/Worker
Patch Set: Split GetPermissionStatus into GetPermissionStatusForFrame/Worker Created 3 years, 6 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
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 "content/common/content_export.h" 8 #include "content/common/content_export.h"
9 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h" 9 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const GURL& requesting_origin, 56 const GURL& requesting_origin,
57 bool user_gesture, 57 bool user_gesture,
58 const base::Callback<void( 58 const base::Callback<void(
59 const std::vector<blink::mojom::PermissionStatus>&)>& callback) = 0; 59 const std::vector<blink::mojom::PermissionStatus>&)>& callback) = 0;
60 60
61 // Cancels a previous permission request specified by |request_id|. Cancelling 61 // Cancels a previous permission request specified by |request_id|. Cancelling
62 // an already cancelled request or providing the |request_id| 62 // an already cancelled request or providing the |request_id|
63 // kNoPendingOperation is a no-op. 63 // kNoPendingOperation is a no-op.
64 virtual void CancelPermissionRequest(int request_id) = 0; 64 virtual void CancelPermissionRequest(int request_id) = 0;
65 65
66 // Returns the permission status of a given requesting_origin/embedding_origin 66 // Returns the PermissionStatus for a specific RenderFrameHost.
67 // tuple. This is not taking a RenderFrameHost because the call might happen 67 virtual blink::mojom::PermissionStatus GetPermissionStatusForFrame(
mlamouri (slow - plz ping) 2017/06/08 13:35:52 Can we drop "ForFrame" and "ForWorkers" and instea
raymes 2017/06/12 03:24:17 Hmm could you explain what you mean a bit more by:
mlamouri (slow - plz ping) 2017/06/15 13:02:08 I think johnme@ mentioned one place.
68 // outside of a frame context. 68 content::PermissionType permission,
69 virtual blink::mojom::PermissionStatus GetPermissionStatus( 69 content::RenderFrameHost* render_frame_host,
70 PermissionType permission, 70 const GURL& requesting_origin) = 0;
71 const GURL& requesting_origin, 71
72 const GURL& embedding_origin) = 0; 72 // Returns the PermissionStatus for a worker. This should not be used for
73 // determining the permission status for a request coming from a
74 // RenderFrameHost.
75 virtual blink::mojom::PermissionStatus GetPermissionStatusForWorker(
76 content::PermissionType permission,
77 const GURL& requesting_origin) = 0;
mlamouri (slow - plz ping) 2017/06/08 13:35:52 No strong opinion on this but maybe we can keep th
raymes 2017/06/12 03:24:17 (Hopefully addressed in the above comment)
73 78
74 // Sets the permission back to its default for the requesting_origin/ 79 // Sets the permission back to its default for the requesting_origin/
75 // embedding_origin tuple. 80 // embedding_origin tuple.
76 virtual void ResetPermission(PermissionType permission, 81 virtual void ResetPermission(PermissionType permission,
77 const GURL& requesting_origin, 82 const GURL& requesting_origin,
78 const GURL& embedding_origin) = 0; 83 const GURL& embedding_origin) = 0;
79 84
80 // Runs the given |callback| whenever the |permission| associated with the 85 // Runs the given |callback| whenever the |permission| associated with the
81 // pair { requesting_origin, embedding_origin } changes. 86 // pair { requesting_origin, embedding_origin } changes.
82 // Returns the subscription_id to be used to unsubscribe. Can be 87 // Returns the subscription_id to be used to unsubscribe. Can be
83 // kNoPendingOperation if the subscribe was not successful. 88 // kNoPendingOperation if the subscribe was not successful.
84 virtual int SubscribePermissionStatusChange( 89 virtual int SubscribePermissionStatusChange(
85 PermissionType permission, 90 PermissionType permission,
86 const GURL& requesting_origin, 91 const GURL& requesting_origin,
87 const GURL& embedding_origin, 92 const GURL& embedding_origin,
88 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) = 0; 93 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) = 0;
89 94
90 // Unregisters from permission status change notifications. 95 // Unregisters from permission status change notifications.
91 // The |subscription_id| must match the value returned by the 96 // The |subscription_id| must match the value returned by the
92 // SubscribePermissionStatusChange call. Unsubscribing 97 // SubscribePermissionStatusChange call. Unsubscribing
93 // an already unsubscribed |subscription_id| or providing the 98 // an already unsubscribed |subscription_id| or providing the
94 // |subscription_id| kNoPendingOperation is a no-op. 99 // |subscription_id| kNoPendingOperation is a no-op.
95 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0; 100 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0;
96 }; 101 };
97 102
98 } // namespace content 103 } // namespace content
99 104
100 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ 105 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698