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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_
8 #include "extensions/common/extension.h"
14 namespace extensions
{
17 struct UnloadedExtensionInfo
;
19 // Observer for ExtensionRegistry. Exists in a separate header file to reduce
20 // the include file burden for typical clients of ExtensionRegistry.
21 class ExtensionRegistryObserver
{
23 virtual ~ExtensionRegistryObserver() {}
25 // Called after an extension is loaded. The extension will exclusively exist
26 // in the enabled_extensions set of ExtensionRegistry.
27 virtual void OnExtensionLoaded(
28 content::BrowserContext
* browser_context
,
29 const Extension
* extension
) {}
31 // Called after an extension is unloaded. The extension no longer exists in
32 // any of the ExtensionRegistry sets (enabled, disabled, etc.).
33 virtual void OnExtensionUnloaded(content::BrowserContext
* browser_context
,
34 const Extension
* extension
,
35 UnloadedExtensionInfo::Reason reason
) {}
37 // Called when |extension| is about to be installed. |is_update| is true if
38 // the installation is the result of it updating, in which case |old_name| is
39 // the name of the extension's previous version.
40 // The ExtensionRegistry will not be tracking |extension| at the time this
41 // event is fired, but will be immediately afterwards (note: not necessarily
42 // enabled; it might be installed in the disabled or even blacklisted sets,
44 // Note that it's much more common to care about extensions being loaded
45 // (OnExtensionLoaded).
46 virtual void OnExtensionWillBeInstalled(
47 content::BrowserContext
* browser_context
,
48 const Extension
* extension
,
50 const std::string
& old_name
) {}
52 // Called after an extension is uninstalled. The extension no longer exsit in
53 // any of the ExtensionRegistry sets (enabled, disabled, etc.).
54 virtual void OnExtensionUninstalled(content::BrowserContext
* browser_context
,
55 const Extension
* extension
) {}
58 } // namespace extensions
60 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_