OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 5 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_action_runner.h" | 7 #include "chrome/browser/extensions/extension_action_runner.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
10 #include "content/public/browser/navigation_handle.h" | 10 #include "content/public/browser/navigation_handle.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 void ActiveTabPermissionGranter::WebContentsDestroyed() { | 172 void ActiveTabPermissionGranter::WebContentsDestroyed() { |
173 ClearActiveExtensionsAndNotify(); | 173 ClearActiveExtensionsAndNotify(); |
174 } | 174 } |
175 | 175 |
176 void ActiveTabPermissionGranter::OnExtensionUnloaded( | 176 void ActiveTabPermissionGranter::OnExtensionUnloaded( |
177 content::BrowserContext* browser_context, | 177 content::BrowserContext* browser_context, |
178 const Extension* extension, | 178 const Extension* extension, |
179 UnloadedExtensionInfo::Reason reason) { | 179 UnloadedExtensionReason reason) { |
180 // Note: don't need to clear the permissions (nor tell the renderer about it) | 180 // Note: don't need to clear the permissions (nor tell the renderer about it) |
181 // because it's being unloaded anyway. | 181 // because it's being unloaded anyway. |
182 granted_extensions_.Remove(extension->id()); | 182 granted_extensions_.Remove(extension->id()); |
183 } | 183 } |
184 | 184 |
185 void ActiveTabPermissionGranter::ClearActiveExtensionsAndNotify() { | 185 void ActiveTabPermissionGranter::ClearActiveExtensionsAndNotify() { |
186 if (granted_extensions_.is_empty()) | 186 if (granted_extensions_.is_empty()) |
187 return; | 187 return; |
188 | 188 |
189 std::set<content::RenderFrameHost*> frame_hosts; | 189 std::set<content::RenderFrameHost*> frame_hosts; |
(...skipping 12 matching lines...) Expand all Loading... |
202 CreateMessageFunction clear_message = | 202 CreateMessageFunction clear_message = |
203 base::Bind(&CreateClearMessage, extension_ids, tab_id_); | 203 base::Bind(&CreateClearMessage, extension_ids, tab_id_); |
204 SendMessageToProcesses(frame_hosts, | 204 SendMessageToProcesses(frame_hosts, |
205 web_contents()->GetRenderProcessHost(), | 205 web_contents()->GetRenderProcessHost(), |
206 clear_message); | 206 clear_message); |
207 | 207 |
208 granted_extensions_.Clear(); | 208 granted_extensions_.Clear(); |
209 } | 209 } |
210 | 210 |
211 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |