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

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

Issue 1316863010: browser: implement multiple permission requesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@request-multiple-content
Patch Set: Cut down on CL size Created 5 years, 3 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 "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
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(
39 content::PermissionStatus)>& callback) override;
40 int RequestPermissions(
41 const std::vector<content::PermissionType>& permissions,
42 content::RenderFrameHost* render_frame_host,
43 const GURL& requesting_origin,
44 bool user_gesture,
45 const base::Callback<void(
46 const std::vector<content::PermissionStatus>&)>& callback) override;
39 void CancelPermissionRequest(content::RenderFrameHost* render_frame_host, 47 void CancelPermissionRequest(content::RenderFrameHost* render_frame_host,
40 int request_id) override; 48 int request_id) override;
41 void ResetPermission(content::PermissionType permission, 49 void ResetPermission(content::PermissionType permission,
42 const GURL& requesting_origin, 50 const GURL& requesting_origin,
43 const GURL& embedding_origin) override; 51 const GURL& embedding_origin) override;
44 content::PermissionStatus GetPermissionStatus( 52 content::PermissionStatus GetPermissionStatus(
45 content::PermissionType permission, 53 content::PermissionType permission,
46 const GURL& requesting_origin, 54 const GURL& requesting_origin,
47 const GURL& embedding_origin) override; 55 const GURL& embedding_origin) override;
48 void RegisterPermissionUsage(content::PermissionType permission, 56 void RegisterPermissionUsage(content::PermissionType permission,
49 const GURL& requesting_origin, 57 const GURL& requesting_origin,
50 const GURL& embedding_origin) override; 58 const GURL& embedding_origin) override;
51 int SubscribePermissionStatusChange( 59 int SubscribePermissionStatusChange(
52 content::PermissionType permission, 60 content::PermissionType permission,
53 const GURL& requesting_origin, 61 const GURL& requesting_origin,
54 const GURL& embedding_origin, 62 const GURL& embedding_origin,
55 const base::Callback<void(content::PermissionStatus)>& callback) override; 63 const base::Callback<void(content::PermissionStatus)>& callback) override;
56 void UnsubscribePermissionStatusChange(int subscription_id) override; 64 void UnsubscribePermissionStatusChange(int subscription_id) override;
57 65
58 private: 66 private:
59 struct PendingRequest; 67 struct PendingRequest;
60 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; 68 using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
61 69
62 struct Subscription; 70 struct Subscription;
63 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>; 71 using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
64 72
73 int RequestPermissionsInternal(
74 const std::vector<content::PermissionType>& permissions,
75 content::RenderFrameHost* render_frame_host,
76 const GURL& requesting_origin,
77 bool user_gesture,
78 const base::Callback<void(
79 const std::vector<content::PermissionStatus>&)>& callback);
80
65 void OnPermissionRequestResponse( 81 void OnPermissionRequestResponse(
66 int request_id, 82 int request_id,
67 const base::Callback<void(content::PermissionStatus)>& callback, 83 int request_index,
68 ContentSetting content_setting); 84 ContentSetting content_setting);
69 85
86 void OnPermissionRequestResponseInternal(
87 int request_id,
88 int request_index,
89 content::PermissionStatus status);
90
70 // Not all WebContents are able to display permission requests. If the PBM 91 // Not all WebContents are able to display permission requests. If the PBM
71 // is required but missing for |web_contents|, don't pass along the request. 92 // is required but missing for |web_contents|, don't pass along the request.
72 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents); 93 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents);
73 94
74 // content_settings::Observer implementation. 95 // content_settings::Observer implementation.
75 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 96 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
76 const ContentSettingsPattern& secondary_pattern, 97 const ContentSettingsPattern& secondary_pattern,
77 ContentSettingsType content_type, 98 ContentSettingsType content_type,
78 std::string resource_identifier) override; 99 std::string resource_identifier) override;
79 100
80 Profile* profile_; 101 Profile* profile_;
81 PendingRequestsMap pending_requests_; 102 PendingRequestsMap pending_requests_;
82 SubscriptionsMap subscriptions_; 103 SubscriptionsMap subscriptions_;
83 104
84 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 105 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
85 106
86 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 107 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
87 }; 108 };
88 109
89 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 110 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_manager.cc » ('j') | content/browser/permissions/permission_service_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698