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

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

Issue 1871343002: Remove PermissionContext factories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <map>
9
8 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
9 #include "base/id_map.h" 11 #include "base/id_map.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
12 #include "components/content_settings/core/browser/content_settings_observer.h" 14 #include "components/content_settings/core/browser/content_settings_observer.h"
13 #include "components/content_settings/core/common/content_settings.h" 15 #include "components/content_settings/core/common/content_settings.h"
14 #include "components/keyed_service/core/keyed_service.h" 16 #include "components/keyed_service/core/keyed_service.h"
15 #include "content/public/browser/permission_manager.h" 17 #include "content/public/browser/permission_manager.h"
16 18
19 class PermissionContextBase;
17 class Profile; 20 class Profile;
18 21
19 namespace content { 22 namespace content {
20 enum class PermissionType; 23 enum class PermissionType;
21 class WebContents; 24 class WebContents;
22 }; // namespace content 25 }; // namespace content
23 26
24 class PermissionManager : public KeyedService, 27 class PermissionManager : public KeyedService,
25 public content::PermissionManager, 28 public content::PermissionManager,
26 public content_settings::Observer { 29 public content_settings::Observer {
27 public: 30 public:
28 explicit PermissionManager(Profile* profile); 31 explicit PermissionManager(Profile* profile);
29 ~PermissionManager() override; 32 ~PermissionManager() override;
30 33
34 PermissionContextBase* GetPermissionContext(content::PermissionType type);
mlamouri (slow - plz ping) 2016/04/11 14:06:05 I would love this to go away actually. No need to
raymes 2016/04/12 07:44:54 I agree. I managed to change all the occurrences i
35
31 // content::PermissionManager implementation. 36 // content::PermissionManager implementation.
32 int RequestPermission( 37 int RequestPermission(
33 content::PermissionType permission, 38 content::PermissionType permission,
34 content::RenderFrameHost* render_frame_host, 39 content::RenderFrameHost* render_frame_host,
35 const GURL& requesting_origin, 40 const GURL& requesting_origin,
36 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) 41 const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
37 override; 42 override;
38 int RequestPermissions( 43 int RequestPermissions(
39 const std::vector<content::PermissionType>& permissions, 44 const std::vector<content::PermissionType>& permissions,
40 content::RenderFrameHost* render_frame_host, 45 content::RenderFrameHost* render_frame_host,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // content_settings::Observer implementation. 91 // content_settings::Observer implementation.
87 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, 92 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
88 const ContentSettingsPattern& secondary_pattern, 93 const ContentSettingsPattern& secondary_pattern,
89 ContentSettingsType content_type, 94 ContentSettingsType content_type,
90 std::string resource_identifier) override; 95 std::string resource_identifier) override;
91 96
92 Profile* profile_; 97 Profile* profile_;
93 PendingRequestsMap pending_requests_; 98 PendingRequestsMap pending_requests_;
94 SubscriptionsMap subscriptions_; 99 SubscriptionsMap subscriptions_;
95 100
101 std::map<content::PermissionType, scoped_ptr<PermissionContextBase>>
102 permission_contexts_;
mlamouri (slow - plz ping) 2016/04/11 14:06:05 What about: std::unordered_map<content::Permission
raymes 2016/04/12 07:44:54 I tried this but got a bunch of link errors becaus
mlamouri (slow - plz ping) 2016/04/12 11:36:39 Would that help to do `enum class PermissionType :
raymes 2016/04/13 00:35:07 Unfortunately doing enum class PermissionType : ch
103
96 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_; 104 base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
97 105
98 DISALLOW_COPY_AND_ASSIGN(PermissionManager); 106 DISALLOW_COPY_AND_ASSIGN(PermissionManager);
99 }; 107 };
100 108
101 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ 109 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698