mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for loading extensions (issue #1947)
- Add CefRequestContext::LoadExtension, CefExtension, CefExtensionHandler and related methods/interfaces. - Add chrome://extensions-support that lists supported Chrome APIs. - Add CefBrowserHost::SetAutoResizeEnabled and CefDisplayHandler::OnAutoResize to support browser resize based on preferred web contents size. - views: Add support for custom CefMenuButton popups. - cefclient: Run with `--load-extension=set_page_color` command-line flag for an extension loading example. Add `--use-views` on Windows and Linux for an even better example.
This commit is contained in:
@@ -5,8 +5,13 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/observer_list.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
#include "extensions/browser/extension_web_contents_observer.h"
|
||||
#include "extensions/browser/script_execution_observer.h"
|
||||
#include "extensions/browser/script_executor.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -17,6 +22,8 @@ class CefExtensionWebContentsObserver
|
||||
public:
|
||||
~CefExtensionWebContentsObserver() override;
|
||||
|
||||
ScriptExecutor* script_executor() { return script_executor_.get(); }
|
||||
|
||||
private:
|
||||
friend class content::WebContentsUserData<CefExtensionWebContentsObserver>;
|
||||
|
||||
@@ -25,6 +32,12 @@ class CefExtensionWebContentsObserver
|
||||
// content::WebContentsObserver overrides.
|
||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||
|
||||
// Our content script observers. Declare at top so that it will outlive all
|
||||
// other members, since they might add themselves as observers.
|
||||
base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
|
||||
|
||||
std::unique_ptr<ScriptExecutor> script_executor_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionWebContentsObserver);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user