Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: android_webview/browser/aw_permission_manager.h

Issue 1943963004: Revert of (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/browser/aw_permission_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "content/public/browser/permission_manager.h" 14 #include "content/public/browser/permission_manager.h"
15 15
16 namespace android_webview { 16 namespace android_webview {
17 17
18 class LastRequestResultCache; 18 class LastRequestResultCache;
19 19
20 class AwPermissionManager : public content::PermissionManager { 20 class AwPermissionManager : public content::PermissionManager {
21 public: 21 public:
22 AwPermissionManager(); 22 AwPermissionManager();
23 ~AwPermissionManager() override; 23 ~AwPermissionManager() override;
24 24
25 // PermissionManager implementation. 25 // PermissionManager implementation.
26 int RequestPermission( 26 int RequestPermission(
27 content::PermissionType permission, 27 content::PermissionType permission,
28 content::RenderFrameHost* render_frame_host, 28 content::RenderFrameHost* render_frame_host,
29 const GURL& requesting_origin, 29 const GURL& requesting_origin,
30 const base::Callback<void(permissions::mojom::PermissionStatus)>& 30 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
31 callback) override; 31 override;
32 int RequestPermissions( 32 int RequestPermissions(
33 const std::vector<content::PermissionType>& permissions, 33 const std::vector<content::PermissionType>& permissions,
34 content::RenderFrameHost* render_frame_host, 34 content::RenderFrameHost* render_frame_host,
35 const GURL& requesting_origin, 35 const GURL& requesting_origin,
36 const base::Callback<void( 36 const base::Callback<
37 const std::vector<permissions::mojom::PermissionStatus>&)>& callback) 37 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
38 override; 38 override;
39 void CancelPermissionRequest(int request_id) override; 39 void CancelPermissionRequest(int request_id) override;
40 void ResetPermission(content::PermissionType permission, 40 void ResetPermission(content::PermissionType permission,
41 const GURL& requesting_origin, 41 const GURL& requesting_origin,
42 const GURL& embedding_origin) override; 42 const GURL& embedding_origin) override;
43 permissions::mojom::PermissionStatus GetPermissionStatus( 43 blink::mojom::PermissionStatus GetPermissionStatus(
44 content::PermissionType permission, 44 content::PermissionType permission,
45 const GURL& requesting_origin, 45 const GURL& requesting_origin,
46 const GURL& embedding_origin) override; 46 const GURL& embedding_origin) override;
47 void RegisterPermissionUsage(content::PermissionType permission, 47 void RegisterPermissionUsage(content::PermissionType permission,
48 const GURL& requesting_origin, 48 const GURL& requesting_origin,
49 const GURL& embedding_origin) override; 49 const GURL& embedding_origin) override;
50 int SubscribePermissionStatusChange( 50 int SubscribePermissionStatusChange(
51 content::PermissionType permission, 51 content::PermissionType permission,
52 const GURL& requesting_origin, 52 const GURL& requesting_origin,
53 const GURL& embedding_origin, 53 const GURL& embedding_origin,
54 const base::Callback<void(permissions::mojom::PermissionStatus)>& 54 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
55 callback) override; 55 override;
56 void UnsubscribePermissionStatusChange(int subscription_id) override; 56 void UnsubscribePermissionStatusChange(int subscription_id) override;
57 57
58 private: 58 private:
59 struct PendingRequest; 59 struct PendingRequest;
60 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; 60 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
61 61
62 // The weak pointer to this is used to clean up any information which is 62 // The weak pointer to this is used to clean up any information which is
63 // 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
64 // 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
65 // is static. 65 // is static.
66 static void OnRequestResponse( 66 static void OnRequestResponse(
67 const base::WeakPtr<AwPermissionManager>& manager, 67 const base::WeakPtr<AwPermissionManager>& manager,
68 int request_id, 68 int request_id,
69 const base::Callback<void(permissions::mojom::PermissionStatus)>& 69 const base::Callback<void(blink::mojom::PermissionStatus)>& callback,
70 callback,
71 bool allowed); 70 bool allowed);
72 71
73 PendingRequestsMap pending_requests_; 72 PendingRequestsMap pending_requests_;
74 std::unique_ptr<LastRequestResultCache> result_cache_; 73 std::unique_ptr<LastRequestResultCache> result_cache_;
75 74
76 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; 75 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_;
77 76
78 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); 77 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager);
79 }; 78 };
80 79
81 } // namespace android_webview 80 } // namespace android_webview
82 81
83 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ 82 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/aw_permission_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698