| 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 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Called after an extension is unloaded. The extension no longer exists in | 38 // Called after an extension is unloaded. The extension no longer exists in |
| 39 // the set |ExtensionRegistry::enabled_extensions()|, but it can still be a | 39 // the set |ExtensionRegistry::enabled_extensions()|, but it can still be a |
| 40 // member of one of the other sets, like disabled, blacklisted or terminated. | 40 // member of one of the other sets, like disabled, blacklisted or terminated. |
| 41 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, | 41 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 42 const Extension* extension, | 42 const Extension* extension, |
| 43 UnloadedExtensionInfo::Reason reason) {} | 43 UnloadedExtensionInfo::Reason reason) {} |
| 44 | 44 |
| 45 // Called when |extension| is about to be installed. |is_update| is true if | 45 // 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 | 46 // the installation is the result of it updating, in which case |old_name| is |
| 47 // the name of the extension's previous version. | 47 // the name of the extension's previous version. |
| 48 // If true, |from_ephemeral| indicates that the extension was previously | |
| 49 // installed ephemerally and has been promoted to a regular installed | |
| 50 // extension. |is_update| will be true, although the version has not | |
| 51 // necessarily changed. | |
| 52 // The ExtensionRegistry will not be tracking |extension| at the time this | 48 // The ExtensionRegistry will not be tracking |extension| at the time this |
| 53 // event is fired, but will be immediately afterwards (note: not necessarily | 49 // event is fired, but will be immediately afterwards (note: not necessarily |
| 54 // enabled; it might be installed in the disabled or even blacklisted sets, | 50 // enabled; it might be installed in the disabled or even blacklisted sets, |
| 55 // for example). | 51 // for example). |
| 56 // Note that it's much more common to care about extensions being loaded | 52 // Note that it's much more common to care about extensions being loaded |
| 57 // (OnExtensionLoaded). | 53 // (OnExtensionLoaded). |
| 58 // | 54 // |
| 59 // TODO(tmdiep): We should stash the state of the previous extension version | 55 // TODO(tmdiep): We should stash the state of the previous extension version |
| 60 // somewhere and have observers retrieve it. |is_update|, |from_ephemeral| | 56 // somewhere and have observers retrieve it. |is_update|, and |old_name| can |
| 61 // and |old_name| can be removed when this is done. | 57 // be removed when this is done. |
| 62 virtual void OnExtensionWillBeInstalled( | 58 virtual void OnExtensionWillBeInstalled( |
| 63 content::BrowserContext* browser_context, | 59 content::BrowserContext* browser_context, |
| 64 const Extension* extension, | 60 const Extension* extension, |
| 65 bool is_update, | 61 bool is_update, |
| 66 bool from_ephemeral, | |
| 67 const std::string& old_name) {} | 62 const std::string& old_name) {} |
| 68 | 63 |
| 69 // Called when the installation of |extension| is complete. At this point the | 64 // Called when the installation of |extension| is complete. At this point the |
| 70 // extension is tracked in one of the ExtensionRegistry sets, but is not | 65 // extension is tracked in one of the ExtensionRegistry sets, but is not |
| 71 // necessarily enabled. | 66 // necessarily enabled. |
| 72 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, | 67 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, |
| 73 const Extension* extension, | 68 const Extension* extension, |
| 74 bool is_update) {} | 69 bool is_update) {} |
| 75 | 70 |
| 76 // Called after an extension is uninstalled. The extension no longer exists in | 71 // Called after an extension is uninstalled. The extension no longer exists in |
| 77 // any of the ExtensionRegistry sets (enabled, disabled, etc.). | 72 // any of the ExtensionRegistry sets (enabled, disabled, etc.). |
| 78 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, | 73 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 79 const Extension* extension, | 74 const Extension* extension, |
| 80 UninstallReason reason) {} | 75 UninstallReason reason) {} |
| 81 | 76 |
| 82 // Notifies observers that the observed object is going away. | 77 // Notifies observers that the observed object is going away. |
| 83 virtual void OnShutdown(ExtensionRegistry* registry) {} | 78 virtual void OnShutdown(ExtensionRegistry* registry) {} |
| 84 }; | 79 }; |
| 85 | 80 |
| 86 } // namespace extensions | 81 } // namespace extensions |
| 87 | 82 |
| 88 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ | 83 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_ |
| OLD | NEW |