refactor: move extension APIs to session.extensions (#45597)
refactor: move extensions to session.extensions
This commit is contained in:
parent
a63f6143ea
commit
e3f61b465d
14 changed files with 508 additions and 205 deletions
|
@ -29,11 +29,6 @@
|
|||
#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 {
|
||||
|
@ -70,9 +65,6 @@ class Session final : public gin::Wrappable<Session>,
|
|||
public IpcDispatcher<Session>,
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
private SpellcheckHunspellDictionary::Observer,
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
private extensions::ExtensionRegistryObserver,
|
||||
#endif
|
||||
private content::DownloadManager::Observer {
|
||||
public:
|
||||
|
@ -156,6 +148,7 @@ class Session final : public gin::Wrappable<Session>,
|
|||
v8::Local<v8::Promise> ClearSharedDictionaryCacheForIsolationKey(
|
||||
const gin_helper::Dictionary& options);
|
||||
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> Extensions(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> ServiceWorkerContext(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);
|
||||
|
@ -178,23 +171,6 @@ class Session final : public gin::Wrappable<Session>,
|
|||
bool IsSpellCheckerEnabled() const;
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
v8::Local<v8::Promise> LoadExtension(const base::FilePath& extension_path,
|
||||
gin::Arguments* args);
|
||||
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
|
||||
|
||||
// disable copy
|
||||
Session(const Session&) = delete;
|
||||
Session& operator=(const Session&) = delete;
|
||||
|
@ -223,6 +199,7 @@ class Session final : public gin::Wrappable<Session>,
|
|||
|
||||
// Cached gin_helper::Wrappable objects.
|
||||
v8::Global<v8::Value> cookies_;
|
||||
v8::Global<v8::Value> extensions_;
|
||||
v8::Global<v8::Value> protocol_;
|
||||
v8::Global<v8::Value> net_log_;
|
||||
v8::Global<v8::Value> service_worker_context_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue