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