| 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 EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "extensions/browser/uninstall_reason.h" | 8 #include "extensions/browser/uninstall_reason.h" |
| 9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 class BrowserContext; | 12 class BrowserContext; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 class Extension; | 17 class Extension; |
| 18 class ExtensionRegistry; | 18 class ExtensionRegistry; |
| 19 struct UnloadedExtensionInfo; | |
| 20 | 19 |
| 21 // Observer for ExtensionRegistry. Exists in a separate header file to reduce | 20 // Observer for ExtensionRegistry. Exists in a separate header file to reduce |
| 22 // the include file burden for typical clients of ExtensionRegistry. | 21 // the include file burden for typical clients of ExtensionRegistry. |
| 23 class ExtensionRegistryObserver { | 22 class ExtensionRegistryObserver { |
| 24 public: | 23 public: |
| 25 virtual ~ExtensionRegistryObserver() {} | 24 virtual ~ExtensionRegistryObserver() {} |
| 26 | 25 |
| 27 // Called after an extension is loaded. The extension will exclusively exist | 26 // Called after an extension is loaded. The extension will exclusively exist |
| 28 // in the enabled_extensions set of ExtensionRegistry. | 27 // in the enabled_extensions set of ExtensionRegistry. |
| 29 virtual void OnExtensionLoaded( | 28 virtual void OnExtensionLoaded( |
| 30 content::BrowserContext* browser_context, | 29 content::BrowserContext* browser_context, |
| 31 const Extension* extension) {} | 30 const Extension* extension) {} |
| 32 | 31 |
| 33 // Called after an extension is loaded and all necessary browser state is | 32 // Called after an extension is loaded and all necessary browser state is |
| 34 // initialized to support the start of the extension's child process. | 33 // initialized to support the start of the extension's child process. |
| 35 virtual void OnExtensionReady(content::BrowserContext* browser_context, | 34 virtual void OnExtensionReady(content::BrowserContext* browser_context, |
| 36 const Extension* extension) {} | 35 const Extension* extension) {} |
| 37 | 36 |
| 38 // Called after an extension is unloaded. The extension no longer exists in | 37 // Called after an extension is unloaded. The extension no longer exists in |
| 39 // the set |ExtensionRegistry::enabled_extensions()|, but it can still be a | 38 // the set |ExtensionRegistry::enabled_extensions()|, but it can still be a |
| 40 // member of one of the other sets, like disabled, blacklisted or terminated. | 39 // member of one of the other sets, like disabled, blacklisted or terminated. |
| 41 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, | 40 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 42 const Extension* extension, | 41 const Extension* extension, |
| 43 UnloadedExtensionInfo::Reason reason) {} | 42 UnloadedExtensionReason reason) {} |
| 44 | 43 |
| 45 // Called when |extension| is about to be installed. |is_update| is true if | 44 // Called when |extension| is about to be installed. |is_update| is true if |
| 46 // the installation is the result of it updating, in which case |old_name| is | 45 // the installation is the result of it updating, in which case |old_name| is |
| 47 // the name of the extension's previous version. | 46 // the name of the extension's previous version. |
| 48 // The ExtensionRegistry will not be tracking |extension| at the time this | 47 // The ExtensionRegistry will not be tracking |extension| at the time this |
| 49 // event is fired, but will be immediately afterwards (note: not necessarily | 48 // event is fired, but will be immediately afterwards (note: not necessarily |
| 50 // enabled; it might be installed in the disabled or even blacklisted sets, | 49 // enabled; it might be installed in the disabled or even blacklisted sets, |
| 51 // for example). | 50 // for example). |
| 52 // Note that it's much more common to care about extensions being loaded | 51 // Note that it's much more common to care about extensions being loaded |
| 53 // (OnExtensionLoaded). | 52 // (OnExtensionLoaded). |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 const Extension* extension, | 73 const Extension* extension, |
| 75 UninstallReason reason) {} | 74 UninstallReason reason) {} |
| 76 | 75 |
| 77 // Notifies observers that the observed object is going away. | 76 // Notifies observers that the observed object is going away. |
| 78 virtual void OnShutdown(ExtensionRegistry* registry) {} | 77 virtual void OnShutdown(ExtensionRegistry* registry) {} |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace extensions | 80 } // namespace extensions |
| 82 | 81 |
| 83 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ | 82 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ |
| OLD | NEW |