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 CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 explicit PermissionManager(Profile* profile); | 29 explicit PermissionManager(Profile* profile); |
30 ~PermissionManager() override; | 30 ~PermissionManager() override; |
31 | 31 |
32 // content::PermissionManager implementation. | 32 // content::PermissionManager implementation. |
33 int RequestPermission( | 33 int RequestPermission( |
34 content::PermissionType permission, | 34 content::PermissionType permission, |
35 content::RenderFrameHost* render_frame_host, | 35 content::RenderFrameHost* render_frame_host, |
36 const GURL& requesting_origin, | 36 const GURL& requesting_origin, |
37 bool user_gesture, | 37 bool user_gesture, |
38 const base::Callback<void(content::PermissionStatus)>& callback) override; | 38 const base::Callback<void(permission::Status)>& callback) 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 content::PermissionStatus GetPermissionStatus( | 43 permission::Status GetPermissionStatus(content::PermissionType permission, |
44 content::PermissionType permission, | 44 const GURL& requesting_origin, |
45 const GURL& requesting_origin, | 45 const GURL& embedding_origin) override; |
46 const GURL& embedding_origin) override; | |
47 void RegisterPermissionUsage(content::PermissionType permission, | 46 void RegisterPermissionUsage(content::PermissionType permission, |
48 const GURL& requesting_origin, | 47 const GURL& requesting_origin, |
49 const GURL& embedding_origin) override; | 48 const GURL& embedding_origin) override; |
50 int SubscribePermissionStatusChange( | 49 int SubscribePermissionStatusChange( |
51 content::PermissionType permission, | 50 content::PermissionType permission, |
52 const GURL& requesting_origin, | 51 const GURL& requesting_origin, |
53 const GURL& embedding_origin, | 52 const GURL& embedding_origin, |
54 const base::Callback<void(content::PermissionStatus)>& callback) override; | 53 const base::Callback<void(permission::Status)>& callback) override; |
55 void UnsubscribePermissionStatusChange(int subscription_id) override; | 54 void UnsubscribePermissionStatusChange(int subscription_id) override; |
56 | 55 |
57 private: | 56 private: |
58 struct PendingRequest; | 57 struct PendingRequest; |
59 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; | 58 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; |
60 | 59 |
61 struct Subscription; | 60 struct Subscription; |
62 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>; | 61 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>; |
63 | 62 |
64 void OnPermissionRequestResponse( | 63 void OnPermissionRequestResponse( |
65 int request_id, | 64 int request_id, |
66 const base::Callback<void(content::PermissionStatus)>& callback, | 65 const base::Callback<void(permission::Status)>& callback, |
67 ContentSetting content_setting); | 66 ContentSetting content_setting); |
68 | 67 |
69 // Not all WebContents are able to display permission requests. If the PBM | 68 // Not all WebContents are able to display permission requests. If the PBM |
70 // is required but missing for |web_contents|, don't pass along the request. | 69 // is required but missing for |web_contents|, don't pass along the request. |
71 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents); | 70 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents); |
72 | 71 |
73 // content_settings::Observer implementation. | 72 // content_settings::Observer implementation. |
74 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, | 73 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, |
75 const ContentSettingsPattern& secondary_pattern, | 74 const ContentSettingsPattern& secondary_pattern, |
76 ContentSettingsType content_type, | 75 ContentSettingsType content_type, |
77 std::string resource_identifier) override; | 76 std::string resource_identifier) override; |
78 | 77 |
79 Profile* profile_; | 78 Profile* profile_; |
80 PendingRequestsMap pending_requests_; | 79 PendingRequestsMap pending_requests_; |
81 SubscriptionsMap subscriptions_; | 80 SubscriptionsMap subscriptions_; |
82 | 81 |
83 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; | 82 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; |
84 | 83 |
85 DISALLOW_COPY_AND_ASSIGN(PermissionManager); | 84 DISALLOW_COPY_AND_ASSIGN(PermissionManager); |
86 }; | 85 }; |
87 | 86 |
88 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ | 87 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ |
OLD | NEW |