| 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 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // If |extension| has the activeTab or tabCapture permission, grants | 40 // If |extension| has the activeTab or tabCapture permission, grants |
| 41 // tab-specific permissions to it until the next page navigation or refresh. | 41 // tab-specific permissions to it until the next page navigation or refresh. |
| 42 void GrantIfRequested(const Extension* extension); | 42 void GrantIfRequested(const Extension* extension); |
| 43 | 43 |
| 44 // Clears tab-specific permissions for all extensions. Used only for testing. | 44 // Clears tab-specific permissions for all extensions. Used only for testing. |
| 45 void RevokeForTesting(); | 45 void RevokeForTesting(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // content::WebContentsObserver implementation. | 48 // content::WebContentsObserver implementation. |
| 49 void DidNavigateMainFrame( | 49 void DidFinishNavigation( |
| 50 const content::LoadCommittedDetails& details, | 50 content::NavigationHandle* navigation_handle) override; |
| 51 const content::FrameNavigateParams& params) override; | |
| 52 void WebContentsDestroyed() override; | 51 void WebContentsDestroyed() override; |
| 53 | 52 |
| 54 // extensions::ExtensionRegistryObserver implementation. | 53 // extensions::ExtensionRegistryObserver implementation. |
| 55 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 54 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 56 const Extension* extension, | 55 const Extension* extension, |
| 57 UnloadedExtensionInfo::Reason reason) override; | 56 UnloadedExtensionInfo::Reason reason) override; |
| 58 | 57 |
| 59 // Clears any tab-specific permissions for all extensions on |tab_id_| and | 58 // Clears any tab-specific permissions for all extensions on |tab_id_| and |
| 60 // notifies renderers. | 59 // notifies renderers. |
| 61 void ClearActiveExtensionsAndNotify(); | 60 void ClearActiveExtensionsAndNotify(); |
| 62 | 61 |
| 63 // The tab ID for this tab. | 62 // The tab ID for this tab. |
| 64 int tab_id_; | 63 int tab_id_; |
| 65 | 64 |
| 66 // Extensions with the activeTab permission that have been granted | 65 // Extensions with the activeTab permission that have been granted |
| 67 // tab-specific permissions until the next navigation/refresh. | 66 // tab-specific permissions until the next navigation/refresh. |
| 68 ExtensionSet granted_extensions_; | 67 ExtensionSet granted_extensions_; |
| 69 | 68 |
| 70 // Listen to extension unloaded notifications. | 69 // Listen to extension unloaded notifications. |
| 71 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 70 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 72 extension_registry_observer_; | 71 extension_registry_observer_; |
| 73 | 72 |
| 74 DISALLOW_COPY_AND_ASSIGN(ActiveTabPermissionGranter); | 73 DISALLOW_COPY_AND_ASSIGN(ActiveTabPermissionGranter); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace extensions | 76 } // namespace extensions |
| 78 | 77 |
| 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ | 78 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_H_ |
| OLD | NEW |