OLD | NEW |
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_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 // The renderer is requesting permission to push messages. | 57 // The renderer is requesting permission to push messages. |
58 // When the answer to a permission request has been determined, |callback| | 58 // When the answer to a permission request has been determined, |callback| |
59 // should be called with the result. | 59 // should be called with the result. |
60 virtual void RequestPermission(content::WebContents* web_contents, | 60 virtual void RequestPermission(content::WebContents* web_contents, |
61 const PermissionRequestID& id, | 61 const PermissionRequestID& id, |
62 const GURL& requesting_frame, | 62 const GURL& requesting_frame, |
63 bool user_gesture, | 63 bool user_gesture, |
64 const BrowserPermissionCallback& callback); | 64 const BrowserPermissionCallback& callback); |
65 | 65 |
| 66 // Withdraw an existing permission request, no op if the permission request |
| 67 // was already cancelled by some other means. |
| 68 virtual void CancelPermissionRequest(content::WebContents* web_contents, |
| 69 const PermissionRequestID& id); |
| 70 |
66 protected: | 71 protected: |
67 // Decide whether the permission should be granted. | 72 // Decide whether the permission should be granted. |
68 // Calls PermissionDecided if permission can be decided non-interactively, | 73 // Calls PermissionDecided if permission can be decided non-interactively, |
69 // or NotifyPermissionSet if permission decided by presenting an infobar. | 74 // or NotifyPermissionSet if permission decided by presenting an infobar. |
70 void DecidePermission(content::WebContents* web_contents, | 75 void DecidePermission(content::WebContents* web_contents, |
71 const PermissionRequestID& id, | 76 const PermissionRequestID& id, |
72 const GURL& requesting_origin, | 77 const GURL& requesting_origin, |
73 const GURL& embedder_origin, | 78 const GURL& embedder_origin, |
74 bool user_gesture, | 79 bool user_gesture, |
75 const BrowserPermissionCallback& callback); | 80 const BrowserPermissionCallback& callback); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 114 |
110 // Called when a bubble is no longer used so it can be cleaned up. | 115 // Called when a bubble is no longer used so it can be cleaned up. |
111 void CleanUpBubble(const PermissionRequestID& id); | 116 void CleanUpBubble(const PermissionRequestID& id); |
112 | 117 |
113 Profile* profile_; | 118 Profile* profile_; |
114 const ContentSettingsType permission_type_; | 119 const ContentSettingsType permission_type_; |
115 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 120 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
116 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> | 121 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> |
117 pending_bubbles_; | 122 pending_bubbles_; |
118 | 123 |
| 124 // Must be the last member, to ensure that it will be |
| 125 // destroyed first, which will invalidate weak pointers |
119 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 126 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
120 }; | 127 }; |
121 | 128 |
122 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 129 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |