Index: android_webview/browser/aw_permission_manager.h |
diff --git a/android_webview/browser/aw_permission_manager.h b/android_webview/browser/aw_permission_manager.h |
index 842170b0bf55a396e80dfa47b15897b212d58fec..cd2b85d692b95c612329e000163099cffbbf24e1 100644 |
--- a/android_webview/browser/aw_permission_manager.h |
+++ b/android_webview/browser/aw_permission_manager.h |
@@ -6,8 +6,10 @@ |
#define ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
#include "base/callback_forward.h" |
+#include "base/id_map.h" |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
#include "content/public/browser/permission_manager.h" |
namespace android_webview { |
@@ -20,10 +22,9 @@ class AwPermissionManager : public content::PermissionManager { |
~AwPermissionManager() override; |
// PermissionManager implementation. |
- void RequestPermission( |
+ int RequestPermission( |
content::PermissionType permission, |
content::RenderFrameHost* render_frame_host, |
- int request_id, |
const GURL& requesting_origin, |
bool user_gesture, |
const base::Callback<void(content::PermissionStatus)>& callback) override; |
@@ -49,8 +50,24 @@ class AwPermissionManager : public content::PermissionManager { |
void UnsubscribePermissionStatusChange(int subscription_id) override; |
private: |
+ class PendingRequest; |
+ using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; |
+ |
+ // The weak pointer to this is used to clean up any information which is |
+ // stored in the pending request or result cache maps. However, the callback |
+ // should be run regardless of whether the class is still alive so the method |
+ // is static. |
+ static void OnRequestResponse( |
mlamouri (slow - plz ping)
2015/09/28 14:15:04
Move that to the .cc file?
Lalit Maganti
2015/09/28 16:07:01
Done.
Apologies for missing your earlier comment
Lalit Maganti
2015/09/29 09:08:00
I've had to switch this back because I utilize som
|
+ const base::WeakPtr<AwPermissionManager>& manager, |
+ int request_id, |
+ const base::Callback<void(content::PermissionStatus)>& callback, |
+ bool allowed); |
+ |
+ PendingRequestsMap pending_requests_; |
scoped_ptr<LastRequestResultCache> result_cache_; |
+ base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); |
}; |