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

Side by Side Diff: chrome/browser/permissions/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 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 59 // over GetPermissionStatus as additional checks can be performed when we know
johnme 2017/06/12 10:18:20 Now that there's only one non-preferred GetPermiss
60 // the exact context the request is coming from. 60 // the exact context the request is coming from.
61 // TODO(raymes): Currently we still pass the |requesting_origin| as a separate 61 // TODO(raymes): Currently we still pass the |requesting_origin| as a separate
62 // parameter because we can't yet guarantee that it matches the last committed 62 // parameter because we can't yet guarantee that it matches the last committed
63 // origin of the RenderFrameHost. See crbug.com/698985. 63 // origin of the RenderFrameHost. See crbug.com/698985.
64 PermissionResult GetPermissionStatusForFrame( 64 PermissionResult GetPermissionStatusForFrame(
65 ContentSettingsType permission, 65 ContentSettingsType permission,
66 content::RenderFrameHost* render_frame_host, 66 content::RenderFrameHost* render_frame_host,
67 const GURL& requesting_origin); 67 const GURL& requesting_origin);
68 68
69 // content::PermissionManager implementation. 69 // content::PermissionManager implementation.
70 int RequestPermission( 70 int RequestPermission(
71 content::PermissionType permission, 71 content::PermissionType permission,
72 content::RenderFrameHost* render_frame_host, 72 content::RenderFrameHost* render_frame_host,
73 const GURL& requesting_origin, 73 const GURL& requesting_origin,
74 bool user_gesture, 74 bool user_gesture,
75 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) 75 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
76 override; 76 override;
77 int RequestPermissions( 77 int RequestPermissions(
78 const std::vector<content::PermissionType>& permissions, 78 const std::vector<content::PermissionType>& permissions,
79 content::RenderFrameHost* render_frame_host, 79 content::RenderFrameHost* render_frame_host,
80 const GURL& requesting_origin, 80 const GURL& requesting_origin,
81 bool user_gesture, 81 bool user_gesture,
82 const base::Callback< 82 const base::Callback<
83 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback) 83 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
84 override; 84 override;
85 void CancelPermissionRequest(int request_id) override; 85 void CancelPermissionRequest(int request_id) override;
86 void ResetPermission(content::PermissionType permission, 86 void ResetPermission(content::PermissionType permission,
87 const GURL& requesting_origin, 87 const GURL& requesting_origin,
88 const GURL& embedding_origin) override; 88 const GURL& embedding_origin) override;
89 blink::mojom::PermissionStatus GetPermissionStatus( 89 blink::mojom::PermissionStatus GetPermissionStatusForFrame(
90 content::PermissionType permission, 90 content::PermissionType permission,
91 const GURL& requesting_origin, 91 content::RenderFrameHost* render_frame_host,
92 const GURL& embedding_origin) override; 92 const GURL& requesting_origin) override;
93 blink::mojom::PermissionStatus GetPermissionStatusForWorker(
94 content::PermissionType permission,
95 const GURL& requesting_origin) override;
93 int SubscribePermissionStatusChange( 96 int SubscribePermissionStatusChange(
94 content::PermissionType permission, 97 content::PermissionType permission,
95 const GURL& requesting_origin, 98 const GURL& requesting_origin,
96 const GURL& embedding_origin, 99 const GURL& embedding_origin,
97 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) 100 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
98 override; 101 override;
99 void UnsubscribePermissionStatusChange(int subscription_id) override; 102 void UnsubscribePermissionStatusChange(int subscription_id) override;
100 103
101 // TODO(raymes): Rather than exposing this, use the denial reason from 104 // TODO(raymes): Rather than exposing this, use the denial reason from
102 // GetPermissionStatus in callers to determine whether a permission is 105 // GetPermissionStatus in callers to determine whether a permission is
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 std::unique_ptr<PermissionContextBase>, 150 std::unique_ptr<PermissionContextBase>,
148 ContentSettingsTypeHash> 151 ContentSettingsTypeHash>
149 permission_contexts_; 152 permission_contexts_;
150 153
151 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 154 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
152 155
153 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 156 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
154 }; 157 };
155 158
156 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 159 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698