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

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, 9 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') | content/browser/DEPS » ('J')
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::PermissionStatus)>& callback) override; 29 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
30 override;
30 int RequestPermissions( 31 int RequestPermissions(
31 const std::vector<content::PermissionType>& permissions, 32 const std::vector<content::PermissionType>& permissions,
32 content::RenderFrameHost* render_frame_host, 33 content::RenderFrameHost* render_frame_host,
33 const GURL& requesting_origin, 34 const GURL& requesting_origin,
34 const base::Callback<void( 35 const base::Callback<
35 const std::vector<content::PermissionStatus>&)>& callback) override; 36 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
37 override;
36 void CancelPermissionRequest(int request_id) override; 38 void CancelPermissionRequest(int request_id) override;
37 void ResetPermission(content::PermissionType permission, 39 void ResetPermission(content::PermissionType permission,
38 const GURL& requesting_origin, 40 const GURL& requesting_origin,
39 const GURL& embedding_origin) override; 41 const GURL& embedding_origin) override;
40 content::PermissionStatus GetPermissionStatus( 42 blink::mojom::PermissionStatus GetPermissionStatus(
41 content::PermissionType permission, 43 content::PermissionType permission,
42 const GURL& requesting_origin, 44 const GURL& requesting_origin,
43 const GURL& embedding_origin) override; 45 const GURL& embedding_origin) override;
44 void RegisterPermissionUsage(content::PermissionType permission, 46 void RegisterPermissionUsage(content::PermissionType permission,
45 const GURL& requesting_origin, 47 const GURL& requesting_origin,
46 const GURL& embedding_origin) override; 48 const GURL& embedding_origin) override;
47 int SubscribePermissionStatusChange( 49 int SubscribePermissionStatusChange(
48 content::PermissionType permission, 50 content::PermissionType permission,
49 const GURL& requesting_origin, 51 const GURL& requesting_origin,
50 const GURL& embedding_origin, 52 const GURL& embedding_origin,
51 const base::Callback<void(content::PermissionStatus)>& callback) override; 53 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
54 override;
52 void UnsubscribePermissionStatusChange(int subscription_id) override; 55 void UnsubscribePermissionStatusChange(int subscription_id) override;
53 56
54 private: 57 private:
55 struct PendingRequest; 58 struct PendingRequest;
56 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; 59 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
57 60
58 // 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
59 // 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
60 // 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
61 // is static. 64 // is static.
62 static void OnRequestResponse( 65 static void OnRequestResponse(
63 const base::WeakPtr<AwPermissionManager>& manager, 66 const base::WeakPtr<AwPermissionManager>& manager,
64 int request_id, 67 int request_id,
65 const base::Callback<void(content::PermissionStatus)>& callback, 68 const base::Callback<void(blink::mojom::PermissionStatus)>& callback,
66 bool allowed); 69 bool allowed);
67 70
68 PendingRequestsMap pending_requests_; 71 PendingRequestsMap pending_requests_;
69 scoped_ptr<LastRequestResultCache> result_cache_; 72 scoped_ptr<LastRequestResultCache> result_cache_;
70 73
71 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_; 74 base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager); 76 DISALLOW_COPY_AND_ASSIGN(AwPermissionManager);
74 }; 77 };
75 78
76 } // namespace android_webview 79 } // namespace android_webview
77 80
78 #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') | content/browser/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698