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

Side by Side Diff: chrome/browser/permissions/permission_manager.h

Issue 2723983004: Add PermissionManager::GetPermissionStatusForFrame function (Closed)
Patch Set: Add PermissionManager::GetPermissionStatusForFrame function Created 3 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
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 CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
7 7
8 #include <unordered_map> 8 #include <unordered_map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const std::vector<ContentSettingsType>& permissions, 48 const std::vector<ContentSettingsType>& permissions,
49 content::RenderFrameHost* render_frame_host, 49 content::RenderFrameHost* render_frame_host,
50 const GURL& requesting_origin, 50 const GURL& requesting_origin,
51 bool user_gesture, 51 bool user_gesture,
52 const base::Callback<void(const std::vector<ContentSetting>&)>& callback); 52 const base::Callback<void(const std::vector<ContentSetting>&)>& callback);
53 53
54 PermissionResult GetPermissionStatus(ContentSettingsType permission, 54 PermissionResult GetPermissionStatus(ContentSettingsType permission,
55 const GURL& requesting_origin, 55 const GURL& requesting_origin,
56 const GURL& embedding_origin); 56 const GURL& embedding_origin);
57 57
58 // Returns the permission status for a given frame. This should be preferred
59 // over GetPermissionStatus as additional checks can be performed when we know
60 // the exact context the request is coming from.
61 PermissionResult GetPermissionStatusForFrame(
62 ContentSettingsType permission,
63 content::RenderFrameHost* render_frame_host);
64
58 // content::PermissionManager implementation. 65 // content::PermissionManager implementation.
59 int RequestPermission( 66 int RequestPermission(
60 content::PermissionType permission, 67 content::PermissionType permission,
61 content::RenderFrameHost* render_frame_host, 68 content::RenderFrameHost* render_frame_host,
62 const GURL& requesting_origin, 69 const GURL& requesting_origin,
63 bool user_gesture, 70 bool user_gesture,
64 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) 71 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
65 override; 72 override;
66 int RequestPermissions( 73 int RequestPermissions(
67 const std::vector<content::PermissionType>& permissions, 74 const std::vector<content::PermissionType>& permissions,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void OnPermissionsRequestResponseStatus(int request_id, 119 void OnPermissionsRequestResponseStatus(int request_id,
113 int permission_id, 120 int permission_id,
114 ContentSetting status); 121 ContentSetting status);
115 122
116 // content_settings::Observer implementation. 123 // content_settings::Observer implementation.
117 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 124 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
118 const ContentSettingsPattern& secondary_pattern, 125 const ContentSettingsPattern& secondary_pattern,
119 ContentSettingsType content_type, 126 ContentSettingsType content_type,
120 std::string resource_identifier) override; 127 std::string resource_identifier) override;
121 128
129 PermissionResult GetPermissionStatusHelper(
dominickn 2017/03/02 06:54:33 This is a little strangely named (I expect a Helpe
benwells 2017/03/02 07:33:05 Maybe GetPermissonStatusInternal?
raymes 2017/03/07 02:31:15 I'd like to avoid GetPermissonStatusInternal becau
130 ContentSettingsType permission,
131 content::RenderFrameHost* render_frame_host,
132 const GURL& requesting_origin,
133 const GURL& embedding_origin);
134
122 Profile* profile_; 135 Profile* profile_;
123 PendingRequestsMap pending_requests_; 136 PendingRequestsMap pending_requests_;
124 SubscriptionsMap subscriptions_; 137 SubscriptionsMap subscriptions_;
125 138
126 std::unordered_map<ContentSettingsType, 139 std::unordered_map<ContentSettingsType,
127 std::unique_ptr<PermissionContextBase>, 140 std::unique_ptr<PermissionContextBase>,
128 ContentSettingsTypeHash> 141 ContentSettingsTypeHash>
129 permission_contexts_; 142 permission_contexts_;
130 143
131 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 144 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
132 145
133 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 146 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
134 }; 147 };
135 148
136 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 149 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_context_base_unittest.cc ('k') | chrome/browser/permissions/permission_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698