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> |
| 9 |
8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
9 #include "base/id_map.h" | 11 #include "base/id_map.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "content/public/browser/permission_manager.h" | 14 #include "content/public/browser/permission_manager.h" |
14 | 15 |
15 namespace android_webview { | 16 namespace android_webview { |
16 | 17 |
17 class LastRequestResultCache; | 18 class LastRequestResultCache; |
18 | 19 |
19 class AwPermissionManager : public content::PermissionManager { | 20 class AwPermissionManager : public content::PermissionManager { |
20 public: | 21 public: |
21 AwPermissionManager(); | 22 AwPermissionManager(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // stored in the pending request or result cache maps. However, the callback | 63 // stored in the pending request or result cache maps. However, the callback |
63 // should be run regardless of whether the class is still alive so the method | 64 // should be run regardless of whether the class is still alive so the method |
64 // is static. | 65 // is static. |
65 static void OnRequestResponse( | 66 static void OnRequestResponse( |
66 const base::WeakPtr<AwPermissionManager>& manager, | 67 const base::WeakPtr<AwPermissionManager>& manager, |
67 int request_id, | 68 int request_id, |
68 const base::Callback<void(content::mojom::PermissionStatus)>& callback, | 69 const base::Callback<void(content::mojom::PermissionStatus)>& callback, |
69 bool allowed); | 70 bool allowed); |
70 | 71 |
71 PendingRequestsMap pending_requests_; | 72 PendingRequestsMap pending_requests_; |
72 scoped_ptr<LastRequestResultCache> result_cache_; | 73 std::unique_ptr<LastRequestResultCache> result_cache_; |
73 | 74 |
74 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; | 75 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; |
75 | 76 |
76 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); | 77 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); |
77 }; | 78 }; |
78 | 79 |
79 } // namespace android_webview | 80 } // namespace android_webview |
80 | 81 |
81 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ | 82 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ |
OLD | NEW |