-
Notifications
You must be signed in to change notification settings - Fork 1
OrionExtensionManager
Curates and manages the installation, loading, unloading, and deletion of extensions
class OrionExtensionManager: OrionBrowserExtensionDelegate
Creates an OrionExtensionManager
and immediately loads all the extensions
into memory
init(windowController: OrionWindowController)
- windowController: The window controller to host the extension manager
The static name of the folder within the application support directory that contains all of the extensions of the app
let extensionFolderName: String = "Orion Extensions"
A default filemanager instance
let fileManager: FileManager = FileManager.default
An array of all the extensions loaded into memory and accessable
var extensions: [OrionBrowserExtension]
A pointer to the window controller for quick UI access
private weak var windowController: OrionWindowController?
Downlodas an extension and passes the data off to the installer
func downloadExtension(extensionURL: URL)
- extensionURL: The url to download the extension from
Installs an extension given the packed file data of the extension
func unpackAndInstallExtension(_ extensionData: Data)
- extensionData: The raw unpacked data corresponding to the extension
Loads all the extensions locaed in the extension directory of the apps application support directory. If an extension is malformed, or if there was an error creating an extension instance, it will not be loaded into memory, but will be skipped.
func loadExtensions()
Deletes an extension given an extension instance. It takes the internalIdentifier
from the instance and passes it over to deleteExtension(internalIdentifier:)
func deleteExtension(browserExtension: OrionBrowserExtension)
- browserExtension: The extension to delete from the filesystem
Deletes an extension given the extensions internal identifier. If the identifier is invalid, no extensions are deleted.
func deleteExtension(internalIdentifier: String, browserExtension: OrionBrowserExtension?)
- internalIdentifier: The identifier of the extension to remove. This also acts as the pathname
- browserExtension: An instance of a browser extension. If not nil, this gets removed from the extension list.
Returns a URL of the application support directory with the subpath appended to it.
func getDirectory(_ subpath: String) -> URL
- subPath: The subpath of the directory as a string to get the URL of
Ensures that all manditory support directories for the extensions exist. If any one of the directories do not exist, this returns false.
func ensureSupportDirectories() -> Bool
Ensures that a directory exists. If the specified directory does not exist, it is created. In the off chance that a directory cannot be created, its URL is not returned.
func ensureDirectory(path: URL) -> URL?
- path: The directory URL to ensure exists.
Wraps FileManger.createDirectory
and catches any errors that may be thrown.
if the directory fails to be created, this function returns false.
func createDirectory(
path: URL,
withIntermediateDirectories: Bool,
attributes: [FileAttributeKey: Any]?
) -> Bool
- path: The path of the directory to create
- withIntermediateDirectories: Determines whether the file manager should create non existent parent directories along with the directory specified.
- attributes: The file attributes for the new directory to create.
Adds an extension toolbar item to the windows toolbar. If the item already exists in the toolbar the the new item is not created.
func addToolbarItem(_ sender: OrionBrowserExtension)
- sender: The browser extension calling the method to add it to the toolbar
Shows the popover menu on the window in the left corner of the screen while in windowed mode, and in front of the screen when in full screen mode
func showPopover(_ sender: OrionBrowserExtension)
- sender: The browser extension requesting to have its popover shown
Generated at 2022-01-11T21:56:49-0800 using swift-doc 1.0.0-rc.1.
Types
- BrowserAction
- MozillaBrowserExtensionManifest
- OptionsUI
- OrionBrowserExtension
- OrionBrowserExtensionError
- OrionDelegate
- OrionExtensionManager
- OrionMenu
- OrionSearchField
- OrionSearchFieldController
- OrionTabStretcherView
- OrionTabbedLocationViewController
- OrionTopSitesAPI
- OrionUserContentController
- OrionWindowController
- OrionWindowType