diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2019-02-05 14:50:22 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2019-02-05 16:56:24 +0100 |
commit | 7aa06a1614b7ca6508d96ee2e8ef0f4c49038a6f (patch) | |
tree | 4331533a6c0fa7a843c831d66e62472a7f8a4d30 /src/core/content_browser_client_qt.cpp | |
parent | 5e92adf5f85c4ec8340d5b7e92166a5e4f8e9883 (diff) | |
parent | f17f815878d1d3f02f464347d2807555cab00a88 (diff) |
Merge remote-tracking branch 'origin/dev' into 5.13
Conflicts:
src/core/content_browser_client_qt.cpp
src/core/content_browser_client_qt.h
Change-Id: I3da791a82dab56fd7535ba1e4c0ab1d9ca74f547
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 095528244..3861d1c95 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -48,6 +48,7 @@ #if QT_CONFIG(webengine_spellchecker) #include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" #endif +#include "components/guest_view/browser/guest_view_base.h" #include "components/network_hints/browser/network_hints_message_filter.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/common/url_schemes.h" @@ -70,6 +71,7 @@ #include "content/public/common/service_names.mojom.h" #include "content/public/common/url_constants.h" #include "media/media_buildflags.h" +#include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "printing/buildflags/buildflags.h" @@ -128,6 +130,16 @@ #include "location_provider_qt.h" #endif +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "extensions/extensions_browser_client_qt.h" +#include "extensions/browser/extension_message_filter.h" +#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h" +#include "extensions/browser/io_thread_extension_message_filter.h" +#include "extensions/common/constants.h" +#include "common/extensions/extensions_client_qt.h" +#include "renderer_host/resource_dispatcher_host_delegate_qt.h" +#endif + #include <QGuiApplication> #include <QLocale> #ifndef QT_NO_OPENGL @@ -252,6 +264,11 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* #if QT_CONFIG(webengine_printing_and_pdf) host->AddFilter(new PrintingMessageFilterQt(host->GetID())); #endif +#if BUILDFLAG(ENABLE_EXTENSIONS) + host->AddFilter(new extensions::ExtensionMessageFilter(host->GetID(), host->GetBrowserContext())); + host->AddFilter(new extensions::IOThreadExtensionMessageFilter(host->GetID(), host->GetBrowserContext())); + host->AddFilter(new extensions::ExtensionsGuestViewMessageFilter(host->GetID(), host->GetBrowserContext())); +#endif //ENABLE_EXTENSIONS service_manager::mojom::ServicePtr service; *service_request = mojo::MakeRequest(&service); @@ -266,7 +283,11 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* void ContentBrowserClientQt::ResourceDispatcherHostCreated() { +#if BUILDFLAG(ENABLE_EXTENSIONS) + m_resourceDispatcherHostDelegate.reset(new ResourceDispatcherHostDelegateQt); +#else m_resourceDispatcherHostDelegate.reset(new content::ResourceDispatcherHostDelegate); +#endif content::ResourceDispatcherHost::Get()->SetDelegate(m_resourceDispatcherHostDelegate.get()); } @@ -285,6 +306,10 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs) { if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) { +#if BUILDFLAG(ENABLE_EXTENSIONS) + if (guest_view::GuestViewBase::IsGuest(webContents)) + return; +#endif // BUILDFLAG(ENABLE_EXTENSIONS) WebContentsDelegateQt* delegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); if (delegate) delegate->overrideWebPreferences(webContents, web_prefs); @@ -404,6 +429,11 @@ void ContentBrowserClientQt::GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes->push_back(content::kChromeDevToolsScheme); } +void ContentBrowserClientQt::GetAdditionalViewSourceSchemes(std::vector<std::string>* additional_schemes) +{ + additional_schemes->push_back(content::kChromeDevToolsScheme); +} + #if defined(Q_OS_LINUX) void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) { @@ -736,4 +766,13 @@ bool ContentBrowserClientQt::ShouldIsolateErrorPage(bool in_main_frame) return false; } +bool ContentBrowserClientQt::ShouldUseProcessPerSite(content::BrowserContext* browser_context, const GURL& effective_url) +{ +#if BUILDFLAG(ENABLE_EXTENSIONS) + if (effective_url.SchemeIs(extensions::kExtensionScheme)) + return true; +#endif + return ContentBrowserClient::ShouldUseProcessPerSite(browser_context, effective_url); +} + } // namespace QtWebEngineCore |