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

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

Issue 2586153002: Move kill switch and secure origin checking logic (Closed)
Patch Set: Move kill switch and secure origin checking logic Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CONTEXT_BASE_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // The renderer is requesting permission to push messages. 74 // The renderer is requesting permission to push messages.
75 // When the answer to a permission request has been determined, |callback| 75 // When the answer to a permission request has been determined, |callback|
76 // should be called with the result. 76 // should be called with the result.
77 virtual void RequestPermission(content::WebContents* web_contents, 77 virtual void RequestPermission(content::WebContents* web_contents,
78 const PermissionRequestID& id, 78 const PermissionRequestID& id,
79 const GURL& requesting_frame, 79 const GURL& requesting_frame,
80 bool user_gesture, 80 bool user_gesture,
81 const BrowserPermissionCallback& callback); 81 const BrowserPermissionCallback& callback);
82 82
83 // Returns whether the permission has been granted, denied... 83 // Returns whether the permission has been granted, denied...
84 virtual ContentSetting GetPermissionStatus( 84 ContentSetting GetPermissionStatus(const GURL& requesting_origin,
85 const GURL& requesting_origin, 85 const GURL& embedding_origin) const;
86 const GURL& embedding_origin) const;
87 86
88 // Resets the permission to its default value. 87 // Resets the permission to its default value.
89 virtual void ResetPermission(const GURL& requesting_origin, 88 virtual void ResetPermission(const GURL& requesting_origin,
90 const GURL& embedding_origin); 89 const GURL& embedding_origin);
91 90
92 // Withdraw an existing permission request, no op if the permission request 91 // Withdraw an existing permission request, no op if the permission request
93 // was already cancelled by some other means. 92 // was already cancelled by some other means.
94 virtual void CancelPermissionRequest(content::WebContents* web_contents, 93 virtual void CancelPermissionRequest(content::WebContents* web_contents,
95 const PermissionRequestID& id); 94 const PermissionRequestID& id);
96 95
97 // Whether the kill switch has been enabled for this permission. 96 // Whether the kill switch has been enabled for this permission.
98 // public for permissions that do not use RequestPermission, like 97 // public for permissions that do not use RequestPermission, like
99 // camera and microphone, and for testing. 98 // camera and microphone, and for testing.
100 bool IsPermissionKillSwitchOn() const; 99 bool IsPermissionKillSwitchOn() const;
101 100
102 protected: 101 protected:
102 virtual ContentSetting GetPermissionStatusInternal(
103 const GURL& requesting_origin,
104 const GURL& embedding_origin) const;
105
103 // Decide whether the permission should be granted. 106 // Decide whether the permission should be granted.
104 // Calls PermissionDecided if permission can be decided non-interactively, 107 // Calls PermissionDecided if permission can be decided non-interactively,
105 // or NotifyPermissionSet if permission decided by presenting an infobar. 108 // or NotifyPermissionSet if permission decided by presenting an infobar.
106 virtual void DecidePermission(content::WebContents* web_contents, 109 virtual void DecidePermission(content::WebContents* web_contents,
107 const PermissionRequestID& id, 110 const PermissionRequestID& id,
108 const GURL& requesting_origin, 111 const GURL& requesting_origin,
109 const GURL& embedding_origin, 112 const GURL& embedding_origin,
110 bool user_gesture, 113 bool user_gesture,
111 const BrowserPermissionCallback& callback); 114 const BrowserPermissionCallback& callback);
112 115
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 #endif 172 #endif
170 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> 173 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>>
171 pending_requests_; 174 pending_requests_;
172 175
173 // Must be the last member, to ensure that it will be 176 // Must be the last member, to ensure that it will be
174 // destroyed first, which will invalidate weak pointers 177 // destroyed first, which will invalidate weak pointers
175 base::WeakPtrFactory<PermissionContextBase> weak_factory_; 178 base::WeakPtrFactory<PermissionContextBase> weak_factory_;
176 }; 179 };
177 180
178 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ 181 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_permission_context.cc ('k') | chrome/browser/permissions/permission_context_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698