diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-15 14:57:23 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-17 09:12:12 +0100 |
commit | cd12379d43f8c2df14b19ebced316aa94b3f6043 (patch) | |
tree | f8ff1ac93a1a5502e60c243c32c54f80b1bd332d /src/core/net | |
parent | 4e6e907001d4cf0833465407f8a0fa68e6ce564b (diff) | |
parent | 4c94370394ccf1e00233669df01599cb6141a5dc (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Idee0142b0e33fdf8ca663f1ef1bcd8b932985043
Diffstat (limited to 'src/core/net')
-rw-r--r-- | src/core/net/plugin_response_interceptor_url_loader_throttle.cpp | 6 | ||||
-rw-r--r-- | src/core/net/proxying_url_loader_factory_qt.cpp | 188 | ||||
-rw-r--r-- | src/core/net/proxying_url_loader_factory_qt.h | 18 | ||||
-rw-r--r-- | src/core/net/system_network_context_manager.cpp | 20 | ||||
-rw-r--r-- | src/core/net/system_network_context_manager.h | 10 | ||||
-rw-r--r-- | src/core/net/webui_controller_factory_qt.cpp | 34 | ||||
-rw-r--r-- | src/core/net/webui_controller_factory_qt.h | 8 |
7 files changed, 126 insertions, 158 deletions
diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp index f6bddd7b2..334b147a5 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp @@ -41,7 +41,7 @@ #include "base/bind.h" #include "base/task/post_task.h" -#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_request_utils.h" @@ -49,10 +49,6 @@ #include "extensions/common/constants.h" #include "extensions/common/extension.h" -#include "extensions/extension_system_qt.h" -#include "profile_adapter.h" -#include "profile_io_data_qt.h" -#include "profile_qt.h" #include "web_contents_delegate_qt.h" #include <string> diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index f174df46c..bc70928ab 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -42,24 +42,17 @@ #include <utility> #include "base/bind.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/global_request_id.h" -#include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/content_constants.h" -#include "content/public/common/url_utils.h" -#include "net/base/load_flags.h" #include "net/http/http_status_code.h" -#include "net/http/http_util.h" +#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h" #include "api/qwebengineurlrequestinfo_p.h" -#include "profile_qt.h" #include "type_conversion.h" +#include "web_contents_adapter.h" #include "web_contents_adapter_client.h" #include "web_contents_view_qt.h" @@ -114,11 +107,10 @@ class InterceptedRequest : public network::mojom::URLLoader , public network::mojom::URLLoaderClient { public: - InterceptedRequest(int process_id, uint64_t request_id, int32_t routing_id, uint32_t options, + InterceptedRequest(ProfileAdapter *profile_adapter, + int process_id, uint64_t request_id, int32_t routing_id, uint32_t options, const network::ResourceRequest &request, const net::MutableNetworkTrafficAnnotationTag &traffic_annotation, - QWebEngineUrlRequestInterceptor *profile_request_interceptor, - QWebEngineUrlRequestInterceptor *page_request_interceptor, mojo::PendingReceiver<network::mojom::URLLoader> loader, mojo::PendingRemote<network::mojom::URLLoaderClient> client, mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory); @@ -144,6 +136,8 @@ public: void PauseReadingBodyFromNet() override; void ResumeReadingBodyFromNet() override; + static inline void cleanup(QWebEngineUrlRequestInfo *info) { delete info; } + private: void InterceptOnUIThread(); void ContinueAfterIntercept(); @@ -161,12 +155,15 @@ private: void SendErrorAndCompleteImmediately(int error_code); + content::WebContents* webContents(); + QWebEngineUrlRequestInterceptor* getProfileInterceptor(); + QWebEngineUrlRequestInterceptor* getPageInterceptor(); + + QPointer<ProfileAdapter> profile_adapter_; const int process_id_; const uint64_t request_id_; const int32_t routing_id_; const uint32_t options_; - bool input_stream_previously_failed_ = false; - bool request_was_redirected_ = false; // If the |target_loader_| called OnComplete with an error this stores it. // That way the destructor can send it to OnReceivedError if safe browsing @@ -177,9 +174,8 @@ private: const net::MutableNetworkTrafficAnnotationTag traffic_annotation_; - QWebEngineUrlRequestInfo request_info_; - QPointer<QWebEngineUrlRequestInterceptor> profile_request_interceptor_; - QPointer<QWebEngineUrlRequestInterceptor> page_request_interceptor_; + QScopedPointer<QWebEngineUrlRequestInfo, InterceptedRequest> request_info_; + mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_; mojo::Remote<network::mojom::URLLoaderClient> target_client_; mojo::Receiver<network::mojom::URLLoaderClient> proxied_client_receiver_{this}; @@ -190,22 +186,20 @@ private: DISALLOW_COPY_AND_ASSIGN(InterceptedRequest); }; -InterceptedRequest::InterceptedRequest(int process_id, uint64_t request_id, int32_t routing_id, uint32_t options, +InterceptedRequest::InterceptedRequest(ProfileAdapter *profile_adapter, + int process_id, uint64_t request_id, int32_t routing_id, uint32_t options, const network::ResourceRequest &request, const net::MutableNetworkTrafficAnnotationTag &traffic_annotation, - QWebEngineUrlRequestInterceptor *profile_request_interceptor, - QWebEngineUrlRequestInterceptor *page_request_interceptor, mojo::PendingReceiver<network::mojom::URLLoader> loader_receiver, mojo::PendingRemote<network::mojom::URLLoaderClient> client, mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory) - : process_id_(process_id) + : profile_adapter_(profile_adapter) + , process_id_(process_id) , request_id_(request_id) , routing_id_(routing_id) , options_(options) , request_(request) , traffic_annotation_(traffic_annotation) - , profile_request_interceptor_(profile_request_interceptor) - , page_request_interceptor_(page_request_interceptor) , proxied_loader_receiver_(this, std::move(loader_receiver)) , target_client_(std::move(client)) , target_factory_(std::move(target_factory)) @@ -224,35 +218,61 @@ InterceptedRequest::~InterceptedRequest() weak_factory_.InvalidateWeakPtrs(); } +content::WebContents* InterceptedRequest::webContents() +{ + if (process_id_) { + content::RenderFrameHost *frameHost = content::RenderFrameHost::FromID(process_id_, request_.render_frame_id); + return content::WebContents::FromRenderFrameHost(frameHost); + } + + return content::WebContents::FromFrameTreeNodeId(request_.render_frame_id); +} + +QWebEngineUrlRequestInterceptor* InterceptedRequest::getProfileInterceptor() +{ + return profile_adapter_ ? profile_adapter_->requestInterceptor() : nullptr; +} + +QWebEngineUrlRequestInterceptor* InterceptedRequest::getPageInterceptor() +{ + if (auto wc = webContents()) { + auto view = static_cast<content::WebContentsImpl *>(wc)->GetView(); + if (WebContentsAdapterClient *client = WebContentsViewQt::from(view)->client()) + return client->webContentsAdapter()->requestInterceptor(); + } + return nullptr; +} + void InterceptedRequest::Restart() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - blink::mojom::ResourceType resourceType = blink::mojom::ResourceType(request_.resource_type); - WebContentsAdapterClient::NavigationType navigationType = - pageTransitionToNavigationType(ui::PageTransition(request_.transition_type)); + // MEMO since all codepatch leading to Restart scheduled and executed as asynchronous tasks in main thread, + // interceptors may change in meantime and also during intercept call, so they should be resolved anew. + // Set here only profile's interceptor since it runs first without going to user code. + auto profileInterceptor = getProfileInterceptor(); + if (!profileInterceptor && !getPageInterceptor()) { + ContinueAfterIntercept(); + return; + } + + auto resourceType = toQt(blink::mojom::ResourceType(request_.resource_type)); + auto navigationType = toQt(pageTransitionToNavigationType(ui::PageTransition(request_.transition_type))); const QUrl originalUrl = toQt(request_.url); const QUrl initiator = request_.request_initiator.has_value() ? toQt(request_.request_initiator->GetURL()) : QUrl(); - content::WebContents *webContents = nullptr; - if (process_id_) { - content::RenderFrameHost *frameHost = content::RenderFrameHost::FromID(process_id_, request_.render_frame_id); - webContents = content::WebContents::FromRenderFrameHost(frameHost); - } else { - webContents = content::WebContents::FromFrameTreeNodeId(request_.render_frame_id); - } - - GURL top_document_url = webContents ? webContents->GetVisibleURL() : GURL(); + auto wc = webContents(); + GURL top_document_url = wc ? wc->GetVisibleURL() : GURL(); QUrl firstPartyUrl; if (!top_document_url.is_empty()) firstPartyUrl = toQt(top_document_url); else firstPartyUrl = toQt(request_.site_for_cookies.RepresentativeUrl()); // m_topDocumentUrl can be empty for the main-frame. - QWebEngineUrlRequestInfoPrivate *infoPrivate = - new QWebEngineUrlRequestInfoPrivate(toQt(resourceType), toQt(navigationType), originalUrl, firstPartyUrl, - initiator, QByteArray::fromStdString(request_.method)); - request_info_ = QWebEngineUrlRequestInfo(infoPrivate); + auto info = new QWebEngineUrlRequestInfoPrivate(resourceType, navigationType, originalUrl, firstPartyUrl, + initiator, QByteArray::fromStdString(request_.method)); + Q_ASSERT(!request_info_); + request_info_.reset(new QWebEngineUrlRequestInfo(info)); InterceptOnUIThread(); ContinueAfterIntercept(); @@ -261,52 +281,59 @@ void InterceptedRequest::Restart() void InterceptedRequest::InterceptOnUIThread() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (profile_request_interceptor_) - profile_request_interceptor_->interceptRequest(request_info_); + if (auto interceptor = getProfileInterceptor()) + interceptor->interceptRequest(*request_info_); - if (!request_info_.changed() && page_request_interceptor_) - page_request_interceptor_->interceptRequest(request_info_); + if (!request_info_->changed()) { + if (auto interceptor = getPageInterceptor()) + interceptor->interceptRequest(*request_info_); + } } void InterceptedRequest::ContinueAfterIntercept() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (request_info_.changed()) { - QWebEngineUrlRequestInfoPrivate &info = *request_info_.d_ptr; - if (info.shouldBlockRequest) - return SendErrorAndCompleteImmediately(net::ERR_BLOCKED_BY_CLIENT); - - for (auto header = info.extraHeaders.constBegin(); header != info.extraHeaders.constEnd(); ++header) { - std::string h = header.key().toStdString(); - if (base::LowerCaseEqualsASCII(h, "referer")) { - request_.referrer = GURL(header.value().toStdString()); - } else { - request_.headers.SetHeader(h, header.value().toStdString()); + if (request_info_) { + // cleanup in scope because of delete this and it's not needed else where after + decltype(request_info_) scoped_request_info(request_info_.take()); + QWebEngineUrlRequestInfoPrivate &info = *scoped_request_info->d_ptr; + + if (info.changed) { + if (info.shouldBlockRequest) + return SendErrorAndCompleteImmediately(net::ERR_BLOCKED_BY_CLIENT); + + for (auto header = info.extraHeaders.constBegin(); header != info.extraHeaders.constEnd(); ++header) { + std::string h = header.key().toStdString(); + if (base::LowerCaseEqualsASCII(h, "referer")) { + request_.referrer = GURL(header.value().toStdString()); + } else { + request_.headers.SetHeader(h, header.value().toStdString()); + } } - } - if (info.shouldRedirectRequest) { - net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy = - request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT - : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL; - net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo( - request_.method, request_.url, request_.site_for_cookies, - first_party_url_policy, request_.referrer_policy, request_.referrer.spec(), - net::HTTP_TEMPORARY_REDIRECT, toGurl(request_info_.requestUrl()), base::nullopt, - false /*insecure_scheme_was_upgraded*/); - - // FIXME: Should probably create a new header. - current_response_->encoded_data_length = 0; - request_.method = redirectInfo.new_method; - request_.url = redirectInfo.new_url; - request_.site_for_cookies = redirectInfo.new_site_for_cookies; - request_.referrer = GURL(redirectInfo.new_referrer); - request_.referrer_policy = redirectInfo.new_referrer_policy; - if (request_.method == net::HttpRequestHeaders::kGetMethod) - request_.request_body = nullptr; - target_client_->OnReceiveRedirect(redirectInfo, std::move(current_response_)); - return; + if (info.shouldRedirectRequest) { + net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy = + request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT + : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL; + net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo( + request_.method, request_.url, request_.site_for_cookies, + first_party_url_policy, request_.referrer_policy, request_.referrer.spec(), + net::HTTP_TEMPORARY_REDIRECT, toGurl(info.url), base::nullopt, + false /*insecure_scheme_was_upgraded*/); + + // FIXME: Should probably create a new header. + current_response_->encoded_data_length = 0; + request_.method = redirectInfo.new_method; + request_.url = redirectInfo.new_url; + request_.site_for_cookies = redirectInfo.new_site_for_cookies; + request_.referrer = GURL(redirectInfo.new_referrer); + request_.referrer_policy = redirectInfo.new_referrer_policy; + if (request_.method == net::HttpRequestHeaders::kGetMethod) + request_.request_body = nullptr; + target_client_->OnReceiveRedirect(redirectInfo, std::move(current_response_)); + return; + } } } @@ -329,7 +356,6 @@ void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr he void InterceptedRequest::OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head) { // TODO(timvolodine): handle redirect override. - request_was_redirected_ = true; current_response_ = head.Clone(); target_client_->OnReceiveRedirect(redirect_info, std::move(head)); request_.url = redirect_info.new_url; @@ -459,10 +485,10 @@ void InterceptedRequest::SendErrorAndCompleteImmediately(int error_code) delete this; } -ProxyingURLLoaderFactoryQt::ProxyingURLLoaderFactoryQt(int process_id, QWebEngineUrlRequestInterceptor *profile, QWebEngineUrlRequestInterceptor *page, +ProxyingURLLoaderFactoryQt::ProxyingURLLoaderFactoryQt(ProfileAdapter *adapter, int process_id, mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver, mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_info) - : m_processId(process_id), m_profileRequestInterceptor(profile), m_pageRequestInterceptor(page), m_weakFactory(this) + : m_profileAdapter(adapter), m_processId(process_id), m_weakFactory(this) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (target_factory_info) { @@ -491,8 +517,8 @@ void ProxyingURLLoaderFactoryQt::CreateLoaderAndStart(mojo::PendingReceiver<netw m_targetFactory->Clone(target_factory_clone.InitWithNewPipeAndPassReceiver()); // Will manage its own lifetime - InterceptedRequest *req = new InterceptedRequest(m_processId, request_id, routing_id, options, request, traffic_annotation, - m_profileRequestInterceptor, m_pageRequestInterceptor, std::move(loader), + InterceptedRequest *req = new InterceptedRequest(m_profileAdapter, m_processId, request_id, routing_id, options, + request, traffic_annotation, std::move(loader), std::move(url_loader_client), std::move(target_factory_clone)); req->Restart(); } diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h index e1bcc276c..5345e3220 100644 --- a/src/core/net/proxying_url_loader_factory_qt.h +++ b/src/core/net/proxying_url_loader_factory_qt.h @@ -42,16 +42,12 @@ #include "base/callback.h" #include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/ref_counted_delete_on_sequence.h" #include "base/memory/weak_ptr.h" -#include "base/optional.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "url/gurl.h" #include <QPointer> // based on aw_proxying_url_loader_factory.h: @@ -59,19 +55,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -QT_FORWARD_DECLARE_CLASS(QWebEngineUrlRequestInterceptor) - -namespace content { -class ResourceContext; -} - namespace QtWebEngineCore { +class ProfileAdapter; + class ProxyingURLLoaderFactoryQt : public network::mojom::URLLoaderFactory { public: - ProxyingURLLoaderFactoryQt(int processId, QWebEngineUrlRequestInterceptor *profile, - QWebEngineUrlRequestInterceptor *page, + ProxyingURLLoaderFactoryQt(ProfileAdapter *adapter, int processId, mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver, mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_target_factory_remote); @@ -89,11 +80,10 @@ private: void OnTargetFactoryError(); void OnProxyBindingError(); + QPointer<ProfileAdapter> m_profileAdapter; int m_processId; mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_proxyReceivers; mojo::Remote<network::mojom::URLLoaderFactory> m_targetFactory; - QPointer<QWebEngineUrlRequestInterceptor> m_profileRequestInterceptor; - QPointer<QWebEngineUrlRequestInterceptor> m_pageRequestInterceptor; base::WeakPtrFactory<ProxyingURLLoaderFactoryQt> m_weakFactory; DISALLOW_COPY_AND_ASSIGN(ProxyingURLLoaderFactoryQt); diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp index 99a207c0e..1fba115c6 100644 --- a/src/core/net/system_network_context_manager.cpp +++ b/src/core/net/system_network_context_manager.cpp @@ -44,35 +44,16 @@ #include "net/system_network_context_manager.h" -#include <set> -#include <unordered_map> -#include <utility> - #include "base/bind.h" #include "base/command_line.h" -#include "base/feature_list.h" -#include "base/logging.h" -#include "base/sequence_checker.h" -#include "base/strings/string_split.h" -#include "base/task/post_task.h" -#include "base/values.h" -#include "build/build_config.h" #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" #include "chrome/common/chrome_switches.h" #include "components/certificate_transparency/ct_known_logs.h" -#include "components/network_session_configurator/common/network_features.h" #include "components/network_session_configurator/common/network_switches.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/network_service_instance.h" -#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/service_names.mojom.h" -#include "content/public/common/user_agent.h" -#include "mojo/public/cpp/bindings/associated_interface_ptr.h" -#include "net/dns/public/util.h" #include "net/net_buildflags.h" -#include "net/third_party/uri_template/uri_template.h" #include "services/network/network_service.h" #include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h" #include "services/network/public/cpp/features.h" @@ -80,7 +61,6 @@ #include "services/network/public/mojom/host_resolver.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" -#include "url/gurl.h" namespace { diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h index bd12fe217..48cd99173 100644 --- a/src/core/net/system_network_context_manager.h +++ b/src/core/net/system_network_context_manager.h @@ -46,16 +46,10 @@ #define SYSTEM_NETWORK_CONTEXT_MANAGER_H_ #include <memory> -#include <string> -#include <vector> #include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/optional.h" -#include "services/network/public/mojom/host_resolver.mojom-forward.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom-forward.h" -#include "services/network/public/mojom/ssl_config.mojom-forward.h" #include "services/network/public/mojom/url_loader_factory.mojom-forward.h" #include "net/proxy_config_monitor.h" @@ -67,10 +61,6 @@ class URLLoaderFactory; class SharedURLLoaderFactory; } // namespace network -namespace net_log { -class NetExportFileWriter; -} - // Responsible for creating and managing access to the system NetworkContext. // Lives on the UI thread. The NetworkContext this owns is intended for requests // not associated with a profile. It stores no data on disk, and has no HTTP diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 27e58d75f..59c5ca205 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -44,39 +44,36 @@ #include "webui_controller_factory_qt.h" +#include "build_config_qt.h" + #include "base/bind.h" -#include "base/location.h" -#include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/accessibility/accessibility_ui.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/devtools_ui.h" #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" +#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/common/url_constants.h" -#include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -#include "content/public/common/content_client.h" #include "content/public/common/url_utils.h" #include "extensions/buildflags/buildflags.h" #include "media/media_buildflags.h" #include "ppapi/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" -#include "ui/web_dialogs/web_dialog_ui.h" #include "url/gurl.h" #if defined(OS_LINUX) || defined(OS_ANDROID) #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h" #endif +#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) +#include "chrome/browser/ui/webui/media/webrtc_logs_ui.h" +#endif + // The Following WebUIs are disabled because they currently doesn't build // or doesn't work, but would be interesting for us if they did: // #include "chrome/browser/ui/webui/inspect_ui.h" -// #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" - -// #if BUILDFLAG(ENABLE_WEBRTC) -// #include "chrome/browser/ui/webui/media/webrtc_logs_ui.h" -// #endif // #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" @@ -137,8 +134,9 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co if (url.host() == chrome::kChromeUIAccessibilityHost) return &NewWebUI<AccessibilityUI>; -// if (url.host_piece() == chrome::kChromeUIUserActionsHost) -// return &NewWebUI<UserActionsUI>; + if (url.host_piece() == chrome::kChromeUIUserActionsHost) + return &NewWebUI<UserActionsUI>; + // if (url.host_piece() == chrome::kChromeUIInspectHost) // return &NewWebUI<InspectUI>; // @@ -150,20 +148,16 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co // if (url.host_piece() == chrome::kChromeUIExtensionsFrameHost) // return &NewWebUI<extensions::ExtensionsUI>; //#endif -//#if BUILDFLAG(ENABLE_PLUGINS) -// if (url.host_piece() == chrome::kChromeUIFlashHost) -// return &NewWebUI<FlashUI>; -//#endif //#if BUILDFLAG(ENABLE_PRINT_PREVIEW) // if (url.host_piece() == chrome::kChromeUIPrintHost && // !profile->GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled)) { // return &NewWebUI<PrintPreviewUI>; // } //#endif -//#if BUILDFLAG(ENABLE_WEBRTC) -// if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost) -// return &NewWebUI<WebRtcLogsUI>; -//#endif +#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) + if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost) + return &NewWebUI<WebRtcLogsUI>; +#endif #if defined(OS_LINUX) || defined(OS_ANDROID) if (url.host_piece() == chrome::kChromeUISandboxHost) return &NewWebUI<SandboxInternalsUI>; diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index 1cc76349b..6dfc612e1 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -42,16 +42,8 @@ #include "base/macros.h" #include "base/memory/singleton.h" -#include "components/favicon_base/favicon_callback.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller_factory.h" -#include "ui/base/layout.h" - -class Profile; - -namespace base { -class RefCountedMemory; -} namespace QtWebEngineCore { |