OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 virtual void UpdateTabContext(const PermissionRequestID& id, | 110 virtual void UpdateTabContext(const PermissionRequestID& id, |
111 const GURL& requesting_origin, | 111 const GURL& requesting_origin, |
112 bool allowed) {} | 112 bool allowed) {} |
113 | 113 |
114 // Return an instance of the infobar queue controller, creating it if needed. | 114 // Return an instance of the infobar queue controller, creating it if needed. |
115 PermissionQueueController* GetQueueController(); | 115 PermissionQueueController* GetQueueController(); |
116 | 116 |
117 // Returns the profile associated with this permission context. | 117 // Returns the profile associated with this permission context. |
118 Profile* profile() const; | 118 Profile* profile() const; |
119 | 119 |
120 // Returns the ContentSettingsType associated with this permission context. | |
121 ContentSettingsType content_settings_type() const; | |
mlamouri (slow - plz ping)
2015/08/26 13:49:34
ContentSettingsType is an implementation details o
guoweis_left_chromium
2015/08/26 22:29:57
Done.
| |
122 | |
120 // Store the decided permission as a content setting. | 123 // Store the decided permission as a content setting. |
121 // virtual since the permission might be stored with different restrictions | 124 // virtual since the permission might be stored with different restrictions |
122 // (for example for desktop notifications). | 125 // (for example for desktop notifications). |
123 virtual void UpdateContentSetting(const GURL& requesting_origin, | 126 virtual void UpdateContentSetting(const GURL& requesting_origin, |
124 const GURL& embedding_origin, | 127 const GURL& embedding_origin, |
125 ContentSetting content_setting); | 128 ContentSetting content_setting); |
126 | 129 |
127 // Whether the permission should be restricted to secure origins. | 130 // Whether the permission should be restricted to secure origins. |
128 virtual bool IsRestrictedToSecureOrigins() const = 0; | 131 virtual bool IsRestrictedToSecureOrigins() const = 0; |
129 | 132 |
130 private: | 133 private: |
131 // Called when a bubble is no longer used so it can be cleaned up. | 134 // Called when a bubble is no longer used so it can be cleaned up. |
132 void CleanUpBubble(const PermissionRequestID& id); | 135 void CleanUpBubble(const PermissionRequestID& id); |
133 | 136 |
134 Profile* profile_; | 137 Profile* profile_; |
135 const ContentSettingsType permission_type_; | 138 const ContentSettingsType permission_type_; |
136 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 139 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
137 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>> | 140 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>> |
138 pending_bubbles_; | 141 pending_bubbles_; |
139 | 142 |
140 // Must be the last member, to ensure that it will be | 143 // Must be the last member, to ensure that it will be |
141 // destroyed first, which will invalidate weak pointers | 144 // destroyed first, which will invalidate weak pointers |
142 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 145 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
143 }; | 146 }; |
144 | 147 |
145 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 148 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |