[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
[chromium-blink-merge.git] / extensions / browser / extension_registry_observer.h
bloba3bfeb38cb13dc0d5991d243827157b7195bd5e8
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/browser/uninstall_reason.h"
9 #include "extensions/common/extension.h"
11 namespace content {
12 class BrowserContext;
15 namespace extensions {
17 class Extension;
18 class ExtensionRegistry;
19 struct UnloadedExtensionInfo;
21 // Observer for ExtensionRegistry. Exists in a separate header file to reduce
22 // the include file burden for typical clients of ExtensionRegistry.
23 class ExtensionRegistryObserver {
24 public:
25 virtual ~ExtensionRegistryObserver() {}
27 // Called after an extension is loaded. The extension will exclusively exist
28 // in the enabled_extensions set of ExtensionRegistry.
29 virtual void OnExtensionLoaded(
30 content::BrowserContext* browser_context,
31 const Extension* extension) {}
33 // Called after an extension is loaded and all necessary browser state is
34 // initialized to support the start of the extension's child process.
35 virtual void OnExtensionReady(content::BrowserContext* browser_context,
36 const Extension* extension) {}
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
40 // member of one of the other sets, like disabled, blacklisted or terminated.
41 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context,
42 const Extension* extension,
43 UnloadedExtensionInfo::Reason reason) {}
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
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
53 // event is fired, but will be immediately afterwards (note: not necessarily
54 // enabled; it might be installed in the disabled or even blacklisted sets,
55 // for example).
56 // Note that it's much more common to care about extensions being loaded
57 // (OnExtensionLoaded).
59 // TODO(tmdiep): We should stash the state of the previous extension version
60 // somewhere and have observers retrieve it. |is_update|, |from_ephemeral|
61 // and |old_name| can be removed when this is done.
62 virtual void OnExtensionWillBeInstalled(
63 content::BrowserContext* browser_context,
64 const Extension* extension,
65 bool is_update,
66 bool from_ephemeral,
67 const std::string& old_name) {}
69 // 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
71 // necessarily enabled.
72 virtual void OnExtensionInstalled(content::BrowserContext* browser_context,
73 const Extension* extension,
74 bool is_update) {}
76 // Called after an extension is uninstalled. The extension no longer exists in
77 // any of the ExtensionRegistry sets (enabled, disabled, etc.).
78 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
79 const Extension* extension,
80 UninstallReason reason) {}
82 // Notifies observers that the observed object is going away.
83 virtual void OnShutdown(ExtensionRegistry* registry) {}
86 } // namespace extensions
88 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_