// Copyright © 2018 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Collections.Generic;
namespace CefSharp
{
///
/// Object representing an extension. Methods may be called on any thread unless otherwise indicated.
///
public interface IExtension
{
///
/// Returns the unique extension identifier. This is calculated based on the
/// extension public key, if available, or on the extension path. See
/// https://developer.chrome.com/extensions/manifest/key for details.
///
string Identifier { get; }
///
/// Returns the absolute path to the extension directory on disk. This value
/// will be prefixed with PK_DIR_RESOURCES if a relative path was passed to
/// IRequestContext.LoadExtension.
///
string Path { get; }
///
/// Returns the extension manifest contents as a CefDictionaryValue object. See
/// https://developer.chrome.com/extensions/manifest for details.
///
IDictionary Manifest { get; }
///
/// Returns true if this object is the same extension as that object.
/// Extensions are considered the same if identifier, path and loader context
/// match.
///
/// extension to compare
/// return true if the same extension
bool IsSame(IExtension that);
///
/// Returns the request context that loaded this extension. Will return NULL
/// for internal extensions or if the extension has been unloaded. See the
/// CefRequestContext::LoadExtension documentation for more information about
/// loader contexts. Must be called on the CEF UI thread.
///
IRequestContext LoaderContext { get; }
///
/// Returns true if this extension is currently loaded. Must be called on the
/// CEF UI thread.
///
bool IsLoaded { get; }
///
/// Unload this extension if it is not an internal extension and is currently
/// loaded. Will result in a call to IExtensionHandler.OnExtensionUnloaded
/// on success.
///
void Unload();
}
}