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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const BrowserPermissionCallback& callback, | 104 const BrowserPermissionCallback& callback, |
105 bool persist, | 105 bool persist, |
106 ContentSetting content_setting); | 106 ContentSetting content_setting); |
107 | 107 |
108 // Implementors can override this method to update the icons on the | 108 // Implementors can override this method to update the icons on the |
109 // url bar with the result of the new permission. | 109 // url bar with the result of the new permission. |
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. | |
115 PermissionQueueController* GetQueueController(); | |
116 | |
117 // Returns the profile associated with this permission context. | 114 // Returns the profile associated with this permission context. |
118 Profile* profile() const; | 115 Profile* profile() const; |
119 | 116 |
120 // Store the decided permission as a content setting. | 117 // Store the decided permission as a content setting. |
121 // virtual since the permission might be stored with different restrictions | 118 // virtual since the permission might be stored with different restrictions |
122 // (for example for desktop notifications). | 119 // (for example for desktop notifications). |
123 virtual void UpdateContentSetting(const GURL& requesting_origin, | 120 virtual void UpdateContentSetting(const GURL& requesting_origin, |
124 const GURL& embedding_origin, | 121 const GURL& embedding_origin, |
125 ContentSetting content_setting); | 122 ContentSetting content_setting); |
126 | 123 |
127 // Whether the permission should be restricted to secure origins. | 124 // Whether the permission should be restricted to secure origins. |
128 virtual bool IsRestrictedToSecureOrigins() const = 0; | 125 virtual bool IsRestrictedToSecureOrigins() const = 0; |
129 | 126 |
130 private: | 127 private: |
131 // Called when a bubble is no longer used so it can be cleaned up. | 128 // Called when a bubble is no longer used so it can be cleaned up. |
132 void CleanUpBubble(const PermissionRequestID& id); | 129 void CleanUpBubble(const PermissionRequestID& id); |
133 | 130 |
134 Profile* profile_; | 131 Profile* profile_; |
135 const ContentSettingsType permission_type_; | 132 const ContentSettingsType permission_type_; |
136 scoped_ptr<PermissionQueueController> permission_queue_controller_; | |
137 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>> | 133 base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>> |
138 pending_bubbles_; | 134 pending_bubbles_; |
139 | 135 |
140 // Must be the last member, to ensure that it will be | 136 // Must be the last member, to ensure that it will be |
141 // destroyed first, which will invalidate weak pointers | 137 // destroyed first, which will invalidate weak pointers |
142 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 138 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
143 }; | 139 }; |
144 | 140 |
145 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 141 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |