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_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Implementors can override this method to update the icons on the | 103 // Implementors can override this method to update the icons on the |
104 // url bar with the result of the new permission. | 104 // url bar with the result of the new permission. |
105 virtual void UpdateTabContext(const PermissionRequestID& id, | 105 virtual void UpdateTabContext(const PermissionRequestID& id, |
106 const GURL& requesting_origin, | 106 const GURL& requesting_origin, |
107 bool allowed) {} | 107 bool allowed) {} |
108 | 108 |
109 // Return an instance of the infobar queue controller, creating it if needed. | 109 // Return an instance of the infobar queue controller, creating it if needed. |
110 PermissionQueueController* GetQueueController(); | 110 PermissionQueueController* GetQueueController(); |
111 | 111 |
| 112 // Returns the profile associated with this permission context. |
| 113 Profile* profile() const; |
| 114 |
112 // Store the decided permission as a content setting. | 115 // Store the decided permission as a content setting. |
113 // virtual since the permission might be stored with different restrictions | 116 // virtual since the permission might be stored with different restrictions |
114 // (for example for desktop notifications). | 117 // (for example for desktop notifications). |
115 virtual void UpdateContentSetting(const GURL& requesting_origin, | 118 virtual void UpdateContentSetting(const GURL& requesting_origin, |
116 const GURL& embedding_origin, | 119 const GURL& embedding_origin, |
117 bool allowed); | 120 bool allowed); |
118 | 121 |
119 private: | 122 private: |
120 // Called when a bubble is no longer used so it can be cleaned up. | 123 // Called when a bubble is no longer used so it can be cleaned up. |
121 void CleanUpBubble(const PermissionRequestID& id); | 124 void CleanUpBubble(const PermissionRequestID& id); |
122 | 125 |
123 Profile* profile_; | 126 Profile* profile_; |
124 const ContentSettingsType permission_type_; | 127 const ContentSettingsType permission_type_; |
125 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 128 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
126 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> | 129 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> |
127 pending_bubbles_; | 130 pending_bubbles_; |
128 | 131 |
129 // Must be the last member, to ensure that it will be | 132 // Must be the last member, to ensure that it will be |
130 // destroyed first, which will invalidate weak pointers | 133 // destroyed first, which will invalidate weak pointers |
131 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 134 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
132 }; | 135 }; |
133 | 136 |
134 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 137 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |