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

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

Issue 1803973002: Content Settings: Add RevocationObserver to measure when permissions are revoked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test 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
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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "components/content_settings/core/browser/content_settings_observer.h" 12 #include "components/content_settings/core/browser/content_settings_observer.h"
13 #include "components/content_settings/core/common/content_settings.h" 13 #include "components/content_settings/core/common/content_settings.h"
14 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
15 #include "content/public/browser/permission_manager.h" 15 #include "content/public/browser/permission_manager.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace content { 19 namespace content {
20 enum class PermissionType; 20 enum class PermissionType;
21 class WebContents; 21 class WebContents;
22 }; // namespace content 22 }; // namespace content
23 23
24 class PermissionManager : public KeyedService, 24 class PermissionManager : public KeyedService,
25 public content::PermissionManager, 25 public content::PermissionManager,
26 public content_settings::Observer { 26 public content_settings::Observer,
27 public content_settings::RevocationObserver {
27 public: 28 public:
28 explicit PermissionManager(Profile* profile); 29 explicit PermissionManager(Profile* profile);
29 ~PermissionManager() override; 30 ~PermissionManager() override;
30 31
31 // content::PermissionManager implementation. 32 // content::PermissionManager implementation.
32 int RequestPermission( 33 int RequestPermission(
33 content::PermissionType permission, 34 content::PermissionType permission,
34 content::RenderFrameHost* render_frame_host, 35 content::RenderFrameHost* render_frame_host,
35 const GURL& requesting_origin, 36 const GURL& requesting_origin,
36 const base::Callback<void(content::PermissionStatus)>& callback) override; 37 const base::Callback<void(content::PermissionStatus)>& callback) override;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Not all WebContents are able to display permission requests. If the PBM 80 // Not all WebContents are able to display permission requests. If the PBM
80 // is required but missing for |web_contents|, don't pass along the request. 81 // is required but missing for |web_contents|, don't pass along the request.
81 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents); 82 bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents);
82 83
83 // content_settings::Observer implementation. 84 // content_settings::Observer implementation.
84 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 85 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
85 const ContentSettingsPattern& secondary_pattern, 86 const ContentSettingsPattern& secondary_pattern,
86 ContentSettingsType content_type, 87 ContentSettingsType content_type,
87 std::string resource_identifier) override; 88 std::string resource_identifier) override;
88 89
90 // content_settings::RevocationObserver implementation.
91 void OnContentSettingRevoked(const GURL& primary_url,
92 const GURL& secondary_url,
93 ContentSettingsType content_type,
94 std::string resource_identifier) override;
95
89 Profile* profile_; 96 Profile* profile_;
90 PendingRequestsMap pending_requests_; 97 PendingRequestsMap pending_requests_;
91 SubscriptionsMap subscriptions_; 98 SubscriptionsMap subscriptions_;
92 99
93 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 100 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
94 101
95 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 102 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
96 }; 103 };
97 104
98 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 105 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698