| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const GURL& embedding_origin) override; | 51 const GURL& embedding_origin) override; |
| 52 int SubscribePermissionStatusChange( | 52 int SubscribePermissionStatusChange( |
| 53 content::PermissionType permission, | 53 content::PermissionType permission, |
| 54 const GURL& requesting_origin, | 54 const GURL& requesting_origin, |
| 55 const GURL& embedding_origin, | 55 const GURL& embedding_origin, |
| 56 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) | 56 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) |
| 57 override; | 57 override; |
| 58 void UnsubscribePermissionStatusChange(int subscription_id) override; | 58 void UnsubscribePermissionStatusChange(int subscription_id) override; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 struct PendingRequest; | 61 class PendingRequest; |
| 62 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; | 62 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; |
| 63 | 63 |
| 64 // The weak pointer to this is used to clean up any information which is | 64 // The weak pointer to this is used to clean up any information which is |
| 65 // stored in the pending request or result cache maps. However, the callback | 65 // stored in the pending request or result cache maps. However, the callback |
| 66 // should be run regardless of whether the class is still alive so the method | 66 // should be run regardless of whether the class is still alive so the method |
| 67 // is static. | 67 // is static. |
| 68 static void OnRequestResponse( | 68 static void OnRequestResponse( |
| 69 const base::WeakPtr<AwPermissionManager>& manager, | 69 const base::WeakPtr<AwPermissionManager>& manager, |
| 70 int request_id, | 70 int request_id, |
| 71 const base::Callback<void(blink::mojom::PermissionStatus)>& callback, | 71 int request_index, |
| 72 bool allowed); | 72 bool allowed); |
| 73 | 73 |
| 74 PendingRequestsMap pending_requests_; | 74 PendingRequestsMap pending_requests_; |
| 75 std::unique_ptr<LastRequestResultCache> result_cache_; | 75 std::unique_ptr<LastRequestResultCache> result_cache_; |
| 76 | 76 |
| 77 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; | 77 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); | 79 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace android_webview | 82 } // namespace android_webview |
| 83 | 83 |
| 84 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ | 84 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
| OLD | NEW |