// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_BROWSER_EXTENSION_IMPL_H_ #define CEF_LIBCEF_BROWSER_EXTENSION_IMPL_H_ #pragma once #include #include "base/memory/raw_ptr.h" #include "cef/include/cef_extension.h" #include "cef/include/cef_extension_handler.h" #include "cef/include/cef_request_context.h" namespace extensions { class Extension; } // CefNavigationEntry implementation class CefExtensionImpl : public CefExtension { public: CefExtensionImpl(const extensions::Extension* extension, CefRequestContext* loader_context, CefRefPtr handler); CefExtensionImpl(const CefExtensionImpl&) = delete; CefExtensionImpl& operator=(const CefExtensionImpl&) = delete; // CefExtension methods. CefString GetIdentifier() override; CefString GetPath() override; CefRefPtr GetManifest() override; bool IsSame(CefRefPtr that) override; CefRefPtr GetHandler() override; CefRefPtr GetLoaderContext() override; bool IsLoaded() override; void Unload() override; void OnExtensionLoaded(); void OnExtensionUnloaded(); // Use this instead of the GetLoaderContext version during // CefRequestContext destruction. CefRequestContext* loader_context() const { return loader_context_; } private: CefString id_; CefString path_; CefRefPtr manifest_; raw_ptr loader_context_; CefRefPtr handler_; // Only accessed on the UI thread. bool unloaded_ = false; IMPLEMENT_REFCOUNTING(CefExtensionImpl); }; #endif // CEF_LIBCEF_BROWSER_EXTENSION_IMPL_H_