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

Side by Side Diff: chrome/browser/permissions/permission_manager.h

Issue 2713083003: Use ContentSetting in chrome/ instead of PermissionStatus (Closed)
Patch Set: really fix build? Created 3 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
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 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 <unordered_map> 8 #include <unordered_map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 20 matching lines...) Expand all
31 static PermissionManager* Get(Profile* profile); 31 static PermissionManager* Get(Profile* profile);
32 32
33 explicit PermissionManager(Profile* profile); 33 explicit PermissionManager(Profile* profile);
34 ~PermissionManager() override; 34 ~PermissionManager() override;
35 35
36 // Callers from within chrome/ should use the methods which take the 36 // Callers from within chrome/ should use the methods which take the
37 // ContentSettingsType enum. The methods which take PermissionType values 37 // ContentSettingsType enum. The methods which take PermissionType values
38 // are for the content::PermissionManager overrides and shouldn't be used 38 // are for the content::PermissionManager overrides and shouldn't be used
39 // from chrome/. 39 // from chrome/.
40 40
41 int RequestPermission( 41 int RequestPermission(ContentSettingsType permission,
42 ContentSettingsType permission, 42 content::RenderFrameHost* render_frame_host,
43 content::RenderFrameHost* render_frame_host, 43 const GURL& requesting_origin,
44 const GURL& requesting_origin, 44 bool user_gesture,
45 bool user_gesture, 45 const base::Callback<void(ContentSetting)>& callback);
46 const base::Callback<void(blink::mojom::PermissionStatus)>& callback);
47 int RequestPermissions( 46 int RequestPermissions(
48 const std::vector<ContentSettingsType>& permissions, 47 const std::vector<ContentSettingsType>& permissions,
49 content::RenderFrameHost* render_frame_host, 48 content::RenderFrameHost* render_frame_host,
50 const GURL& requesting_origin, 49 const GURL& requesting_origin,
51 bool user_gesture, 50 bool user_gesture,
52 const base::Callback< 51 const base::Callback<void(const std::vector<ContentSetting>&)>& callback);
53 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback);
54 52
55 blink::mojom::PermissionStatus GetPermissionStatus( 53 ContentSetting GetPermissionStatus(ContentSettingsType permission,
56 ContentSettingsType permission, 54 const GURL& requesting_origin,
57 const GURL& requesting_origin, 55 const GURL& embedding_origin);
58 const GURL& embedding_origin);
59 56
60 // content::PermissionManager implementation. 57 // content::PermissionManager implementation.
61 int RequestPermission( 58 int RequestPermission(
62 content::PermissionType permission, 59 content::PermissionType permission,
63 content::RenderFrameHost* render_frame_host, 60 content::RenderFrameHost* render_frame_host,
64 const GURL& requesting_origin, 61 const GURL& requesting_origin,
65 bool user_gesture, 62 bool user_gesture,
66 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) 63 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
67 override; 64 override;
68 int RequestPermissions( 65 int RequestPermissions(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 using SubscriptionsMap = IDMap<std::unique_ptr<Subscription>>; 101 using SubscriptionsMap = IDMap<std::unique_ptr<Subscription>>;
105 102
106 PermissionContextBase* GetPermissionContext(ContentSettingsType type); 103 PermissionContextBase* GetPermissionContext(ContentSettingsType type);
107 104
108 // Called when a permission was decided for a given PendingRequest. The 105 // Called when a permission was decided for a given PendingRequest. The
109 // PendingRequest is identified by its |request_id| and the permission is 106 // PendingRequest is identified by its |request_id| and the permission is
110 // identified by its |permission_id|. If the PendingRequest contains more than 107 // identified by its |permission_id|. If the PendingRequest contains more than
111 // one permission, it will wait for the remaining permissions to be resolved. 108 // one permission, it will wait for the remaining permissions to be resolved.
112 // When all the permissions have been resolved, the PendingRequest's callback 109 // When all the permissions have been resolved, the PendingRequest's callback
113 // is run. 110 // is run.
114 void OnPermissionsRequestResponseStatus( 111 void OnPermissionsRequestResponseStatus(int request_id,
115 int request_id, 112 int permission_id,
116 int permission_id, 113 ContentSetting status);
117 blink::mojom::PermissionStatus status);
118 114
119 // content_settings::Observer implementation. 115 // content_settings::Observer implementation.
120 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 116 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
121 const ContentSettingsPattern& secondary_pattern, 117 const ContentSettingsPattern& secondary_pattern,
122 ContentSettingsType content_type, 118 ContentSettingsType content_type,
123 std::string resource_identifier) override; 119 std::string resource_identifier) override;
124 120
125 Profile* profile_; 121 Profile* profile_;
126 PendingRequestsMap pending_requests_; 122 PendingRequestsMap pending_requests_;
127 SubscriptionsMap subscriptions_; 123 SubscriptionsMap subscriptions_;
128 124
129 std::unordered_map<ContentSettingsType, 125 std::unordered_map<ContentSettingsType,
130 std::unique_ptr<PermissionContextBase>, 126 std::unique_ptr<PermissionContextBase>,
131 ContentSettingsTypeHash> 127 ContentSettingsTypeHash>
132 permission_contexts_; 128 permission_contexts_;
133 129
134 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 130 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
135 131
136 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 132 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
137 }; 133 };
138 134
139 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 135 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698