| OLD | NEW |
| 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 ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const GURL& embedding_origin, | 56 const GURL& embedding_origin, |
| 57 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) | 57 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) |
| 58 override; | 58 override; |
| 59 void UnsubscribePermissionStatusChange(int subscription_id) override; | 59 void UnsubscribePermissionStatusChange(int subscription_id) override; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 void CancelPermissionRequests(); | 62 void CancelPermissionRequests(); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 class PendingRequest; | 65 class PendingRequest; |
| 66 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; | 66 using PendingRequestsMap = IDMap<std::unique_ptr<PendingRequest>>; |
| 67 | 67 |
| 68 virtual int GetRenderProcessID(content::RenderFrameHost* render_frame_host); | 68 virtual int GetRenderProcessID(content::RenderFrameHost* render_frame_host); |
| 69 virtual int GetRenderFrameID(content::RenderFrameHost* render_frame_host); | 69 virtual int GetRenderFrameID(content::RenderFrameHost* render_frame_host); |
| 70 virtual GURL LastCommittedOrigin(content::RenderFrameHost* render_frame_host); | 70 virtual GURL LastCommittedOrigin(content::RenderFrameHost* render_frame_host); |
| 71 virtual AwBrowserPermissionRequestDelegate* GetDelegate(int render_process_id, | 71 virtual AwBrowserPermissionRequestDelegate* GetDelegate(int render_process_id, |
| 72 int render_frame_id); | 72 int render_frame_id); |
| 73 | 73 |
| 74 // The weak pointer to this is used to clean up any information which is | 74 // The weak pointer to this is used to clean up any information which is |
| 75 // stored in the pending request or result cache maps. However, the callback | 75 // stored in the pending request or result cache maps. However, the callback |
| 76 // should be run regardless of whether the class is still alive so the method | 76 // should be run regardless of whether the class is still alive so the method |
| 77 // is static. | 77 // is static. |
| 78 static void OnRequestResponse( | 78 static void OnRequestResponse( |
| 79 const base::WeakPtr<AwPermissionManager>& manager, | 79 const base::WeakPtr<AwPermissionManager>& manager, |
| 80 int request_id, | 80 int request_id, |
| 81 content::PermissionType permission, | 81 content::PermissionType permission, |
| 82 bool allowed); | 82 bool allowed); |
| 83 | 83 |
| 84 PendingRequestsMap pending_requests_; | 84 PendingRequestsMap pending_requests_; |
| 85 std::unique_ptr<LastRequestResultCache> result_cache_; | 85 std::unique_ptr<LastRequestResultCache> result_cache_; |
| 86 | 86 |
| 87 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; | 87 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); | 89 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace android_webview | 92 } // namespace android_webview |
| 93 | 93 |
| 94 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ | 94 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
| OLD | NEW |