feat(extensions): expose ExtensionRegistryObserver events in Session (#25385)
* feat(extensions): expose ExtensionRegistryObserver events in Session Extensions can be loaded and unloaded for various reasons. In some cases this can occur by no means of the Electron programmer, such as in the case of chrome.runtime.reload(). In order to be able to manage state about extensions outside of Electron's APIs, events reloaded to loading and unloaded are needed. * docs(extensions): elaborate on extension-loaded/unloaded details * fix: remove scoped extension registry observer * docs: update extension-unloaded
This commit is contained in:
parent
881ac995da
commit
9d0d9a1664
4 changed files with 92 additions and 0 deletions
|
@ -25,6 +25,11 @@
|
|||
#include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" // nogncheck
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/extension_registry_observer.h"
|
||||
#endif
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace base {
|
||||
|
@ -55,6 +60,9 @@ class Session : public gin::Wrappable<Session>,
|
|||
public gin_helper::CleanedUpAtExit,
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
public SpellcheckHunspellDictionary::Observer,
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
public extensions::ExtensionRegistryObserver,
|
||||
#endif
|
||||
public content::DownloadManager::Observer {
|
||||
public:
|
||||
|
@ -126,6 +134,15 @@ class Session : public gin::Wrappable<Session>,
|
|||
void RemoveExtension(const std::string& extension_id);
|
||||
v8::Local<v8::Value> GetExtension(const std::string& extension_id);
|
||||
v8::Local<v8::Value> GetAllExtensions();
|
||||
|
||||
// extensions::ExtensionRegistryObserver:
|
||||
void OnExtensionLoaded(content::BrowserContext* browser_context,
|
||||
const extensions::Extension* extension) override;
|
||||
void OnExtensionReady(content::BrowserContext* browser_context,
|
||||
const extensions::Extension* extension) override;
|
||||
void OnExtensionUnloaded(content::BrowserContext* browser_context,
|
||||
const extensions::Extension* extension,
|
||||
extensions::UnloadedExtensionReason reason) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue