alloy: Fix extension function registration for print preview dialog (fixes issue #3167)

This commit is contained in:
Marshall Greenblatt 2022-02-02 14:45:53 -05:00
parent 9667789621
commit 4adc23a52a
4 changed files with 13 additions and 5 deletions

View File

@ -1518,6 +1518,18 @@ bool AlloyContentBrowserClient::ShouldAllowPluginCreation(
return true;
}
void AlloyContentBrowserClient::OnWebContentsCreated(
content::WebContents* web_contents) {
// Attach universal WebContentsObservers. These are quite rare, and in most
// cases CefBrowserPlatformDelegateAlloy::BrowserCreated and/or
// CefExtensionsAPIClient::AttachWebContentsHelpers should be used instead.
if (extensions::ExtensionsEnabled()) {
extensions::CefExtensionWebContentsObserver::CreateForWebContents(
web_contents);
}
}
bool AlloyContentBrowserClient::IsFindInPageDisabledForOrigin(
const url::Origin& origin) {
// For PDF viewing with the PPAPI-free PDF Viewer, find-in-page should only

View File

@ -237,6 +237,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
bool ShouldAllowPluginCreation(
const url::Origin& embedder_origin,
const content::PepperPluginInfo& plugin_info) override;
void OnWebContentsCreated(content::WebContents* web_contents) override;
bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override;
CefRefPtr<CefRequestContextImpl> request_context() const;

View File

@ -179,9 +179,6 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
printing::CefPrintViewManager::CreateForWebContents(web_contents_);
if (extensions::ExtensionsEnabled()) {
extensions::CefExtensionWebContentsObserver::CreateForWebContents(
web_contents_);
// Used by the tabs extension API.
zoom::ZoomController::CreateForWebContents(web_contents_);
}

View File

@ -52,8 +52,6 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
PrefsTabHelper::CreateForWebContents(web_contents);
printing::CefPrintViewManager::CreateForWebContents(web_contents);
CefExtensionWebContentsObserver::CreateForWebContents(web_contents);
// Used by the PDF extension.
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>(