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

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

Issue 1771743002: Move geolocation and permission mojoms into WebKit/public/platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/id_map.h" 9 #include "base/id_map.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/permission_manager.h" 13 #include "content/public/browser/permission_manager.h"
14 14
15 namespace android_webview { 15 namespace android_webview {
16 16
17 class LastRequestResultCache; 17 class LastRequestResultCache;
18 18
19 class AwPermissionManager : public content::PermissionManager { 19 class AwPermissionManager : public content::PermissionManager {
20 public: 20 public:
21 AwPermissionManager(); 21 AwPermissionManager();
22 ~AwPermissionManager() override; 22 ~AwPermissionManager() override;
23 23
24 // PermissionManager implementation. 24 // PermissionManager implementation.
25 int RequestPermission( 25 int RequestPermission(
26 content::PermissionType permission, 26 content::PermissionType permission,
27 content::RenderFrameHost* render_frame_host, 27 content::RenderFrameHost* render_frame_host,
28 const GURL& requesting_origin, 28 const GURL& requesting_origin,
29 const base::Callback<void(content::mojom::PermissionStatus)>& callback) 29 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
30 override; 30 override;
31 int RequestPermissions( 31 int RequestPermissions(
32 const std::vector<content::PermissionType>& permissions, 32 const std::vector<content::PermissionType>& permissions,
33 content::RenderFrameHost* render_frame_host, 33 content::RenderFrameHost* render_frame_host,
34 const GURL& requesting_origin, 34 const GURL& requesting_origin,
35 const base::Callback< 35 const base::Callback<
36 void(const std::vector<content::mojom::PermissionStatus>&)>& callback) 36 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
37 override; 37 override;
38 void CancelPermissionRequest(int request_id) override; 38 void CancelPermissionRequest(int request_id) override;
39 void ResetPermission(content::PermissionType permission, 39 void ResetPermission(content::PermissionType permission,
40 const GURL& requesting_origin, 40 const GURL& requesting_origin,
41 const GURL& embedding_origin) override; 41 const GURL& embedding_origin) override;
42 content::mojom::PermissionStatus GetPermissionStatus( 42 blink::mojom::PermissionStatus GetPermissionStatus(
43 content::PermissionType permission, 43 content::PermissionType permission,
44 const GURL& requesting_origin, 44 const GURL& requesting_origin,
45 const GURL& embedding_origin) override; 45 const GURL& embedding_origin) override;
46 void RegisterPermissionUsage(content::PermissionType permission, 46 void RegisterPermissionUsage(content::PermissionType permission,
47 const GURL& requesting_origin, 47 const GURL& requesting_origin,
48 const GURL& embedding_origin) override; 48 const GURL& embedding_origin) override;
49 int SubscribePermissionStatusChange( 49 int SubscribePermissionStatusChange(
50 content::PermissionType permission, 50 content::PermissionType permission,
51 const GURL& requesting_origin, 51 const GURL& requesting_origin,
52 const GURL& embedding_origin, 52 const GURL& embedding_origin,
53 const base::Callback<void(content::mojom::PermissionStatus)>& callback) 53 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
54 override; 54 override;
55 void UnsubscribePermissionStatusChange(int subscription_id) override; 55 void UnsubscribePermissionStatusChange(int subscription_id) override;
56 56
57 private: 57 private:
58 struct PendingRequest; 58 struct PendingRequest;
59 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; 59 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
60 60
61 // The weak pointer to this is used to clean up any information which is 61 // The weak pointer to this is used to clean up any information which is
62 // stored in the pending request or result cache maps. However, the callback 62 // 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 63 // should be run regardless of whether the class is still alive so the method
64 // is static. 64 // is static.
65 static void OnRequestResponse( 65 static void OnRequestResponse(
66 const base::WeakPtr<AwPermissionManager>& manager, 66 const base::WeakPtr<AwPermissionManager>& manager,
67 int request_id, 67 int request_id,
68 const base::Callback<void(content::mojom::PermissionStatus)>& callback, 68 const base::Callback<void(blink::mojom::PermissionStatus)>& callback,
69 bool allowed); 69 bool allowed);
70 70
71 PendingRequestsMap pending_requests_; 71 PendingRequestsMap pending_requests_;
72 scoped_ptr<LastRequestResultCache> result_cache_; 72 scoped_ptr<LastRequestResultCache> result_cache_;
73 73
74 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; 74 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); 76 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager);
77 }; 77 };
78 78
79 } // namespace android_webview 79 } // namespace android_webview
80 80
81 #endif // ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_ 81 #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