summaryrefslogtreecommitdiffstats
path: root/src/core/renderer_host
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-28 11:19:54 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-12 13:39:39 +0100
commitb8c6c4a8588374cd0e1830871134d44d0460e0e8 (patch)
treeff99074cd6232c836e2571221a41d1d28b28bd2e /src/core/renderer_host
parent558ca97112eb2e82443e9b8ba1a703fee15694dd (diff)
Cleanup renderer_host
Selective application of clang-format in src/core/renderer_host Change-Id: I6fc78374be914dca15b15ab8b8f4b7bed83f21af Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/renderer_host')
-rw-r--r--src/core/renderer_host/render_view_observer_host_qt.cpp7
-rw-r--r--src/core/renderer_host/render_view_observer_host_qt.h10
-rw-r--r--src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp47
-rw-r--r--src/core/renderer_host/resource_dispatcher_host_delegate_qt.h8
-rw-r--r--src/core/renderer_host/user_resource_controller_host.cpp43
-rw-r--r--src/core/renderer_host/user_resource_controller_host.h3
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp5
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.h6
8 files changed, 60 insertions, 69 deletions
diff --git a/src/core/renderer_host/render_view_observer_host_qt.cpp b/src/core/renderer_host/render_view_observer_host_qt.cpp
index c097e102d..165a9d86a 100644
--- a/src/core/renderer_host/render_view_observer_host_qt.cpp
+++ b/src/core/renderer_host/render_view_observer_host_qt.cpp
@@ -69,7 +69,7 @@ void RenderViewObserverHostQt::fetchDocumentInnerText(quint64 requestId)
web_contents()->GetRenderViewHost()->GetRoutingID(), requestId));
}
-bool RenderViewObserverHostQt::OnMessageReceived(const IPC::Message& message)
+bool RenderViewObserverHostQt::OnMessageReceived(const IPC::Message &message)
{
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderViewObserverHostQt, message)
@@ -80,15 +80,14 @@ bool RenderViewObserverHostQt::OnMessageReceived(const IPC::Message& message)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
-
}
-void RenderViewObserverHostQt::onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup)
+void RenderViewObserverHostQt::onDidFetchDocumentMarkup(quint64 requestId, const base::string16 &markup)
{
m_adapterClient->didFetchDocumentMarkup(requestId, toQt(markup));
}
-void RenderViewObserverHostQt::onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText)
+void RenderViewObserverHostQt::onDidFetchDocumentInnerText(quint64 requestId, const base::string16 &innerText)
{
m_adapterClient->didFetchDocumentInnerText(requestId, toQt(innerText));
}
diff --git a/src/core/renderer_host/render_view_observer_host_qt.h b/src/core/renderer_host/render_view_observer_host_qt.h
index a08263e07..8590ecbc5 100644
--- a/src/core/renderer_host/render_view_observer_host_qt.h
+++ b/src/core/renderer_host/render_view_observer_host_qt.h
@@ -45,7 +45,7 @@
#include <QtGlobal>
namespace content {
- class WebContents;
+class WebContents;
}
namespace QtWebEngineCore {
@@ -55,14 +55,14 @@ class WebContentsAdapterClient;
class RenderViewObserverHostQt : public content::WebContentsObserver
{
public:
- RenderViewObserverHostQt(content::WebContents*, WebContentsAdapterClient *adapterClient);
+ RenderViewObserverHostQt(content::WebContents *, WebContentsAdapterClient *adapterClient);
void fetchDocumentMarkup(quint64 requestId);
void fetchDocumentInnerText(quint64 requestId);
private:
- bool OnMessageReceived(const IPC::Message& message) override;
- void onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup);
- void onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText);
+ bool OnMessageReceived(const IPC::Message &message) override;
+ void onDidFetchDocumentMarkup(quint64 requestId, const base::string16 &markup);
+ void onDidFetchDocumentInnerText(quint64 requestId, const base::string16 &innerText);
WebContentsAdapterClient *m_adapterClient;
};
diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
index a08e2cf88..59b0ca516 100644
--- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
+++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp
@@ -77,17 +77,14 @@
namespace QtWebEngineCore {
-void OnPdfStreamIntercepted(
- const GURL& original_url,
- std::string extension_id,
- int frame_tree_node_id,
- const content::ResourceRequestInfo::WebContentsGetter&
- web_contents_getter) {
- content::WebContents* web_contents = web_contents_getter.Run();
+void OnPdfStreamIntercepted(const GURL &original_url, std::string extension_id, int frame_tree_node_id,
+ const content::ResourceRequestInfo::WebContentsGetter &web_contents_getter)
+{
+ content::WebContents *web_contents = web_contents_getter.Run();
if (!web_contents)
return;
- WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate());
+ WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate());
if (!contentsDelegate)
return;
@@ -97,19 +94,17 @@ void OnPdfStreamIntercepted(
// If the applications has been set up to always download PDF files to open them in an
// external viewer, trigger the download.
std::unique_ptr<download::DownloadUrlParameters> params(
- content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame(
- web_contents, original_url, MISSING_TRAFFIC_ANNOTATION));
- content::BrowserContext::GetDownloadManager(web_contents->GetBrowserContext())
- ->DownloadUrl(std::move(params));
+ content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame(web_contents, original_url,
+ MISSING_TRAFFIC_ANNOTATION));
+ content::BrowserContext::GetDownloadManager(web_contents->GetBrowserContext())->DownloadUrl(std::move(params));
return;
}
// The URL passes the original pdf resource url, that will be requested
// by the pdf viewer extension page.
content::NavigationController::LoadURLParams params(
- GURL(base::StringPrintf("%s://%s/index.html?%s", extensions::kExtensionScheme,
- extension_id.c_str(),
- original_url.spec().c_str())));
+ GURL(base::StringPrintf("%s://%s/index.html?%s", extensions::kExtensionScheme,
+ extension_id.c_str(), original_url.spec().c_str())));
params.frame_tree_node_id = frame_tree_node_id;
web_contents->GetController().LoadURLWithParams(params);
@@ -120,8 +115,7 @@ bool ResourceDispatcherHostDelegateQt::ShouldInterceptResourceAsStream(net::URLR
GURL *origin,
std::string *payload)
{
- content::ResourceRequestInfo* info =
- content::ResourceRequestInfo::ForRequest(request);
+ content::ResourceRequestInfo *info = content::ResourceRequestInfo::ForRequest(request);
int render_process_host_id = -1;
int render_frame_id = -1;
@@ -130,7 +124,8 @@ bool ResourceDispatcherHostDelegateQt::ShouldInterceptResourceAsStream(net::URLR
std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist();
- extensions::ExtensionSystemQt *extensionSystem = ProfileIODataQt::FromResourceContext(info->GetContext())->GetExtensionSystem();
+ extensions::ExtensionSystemQt *extensionSystem =
+ ProfileIODataQt::FromResourceContext(info->GetContext())->GetExtensionSystem();
if (!extensionSystem)
return false;
@@ -141,7 +136,7 @@ bool ResourceDispatcherHostDelegateQt::ShouldInterceptResourceAsStream(net::URLR
if (!extension)
continue;
- MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension);
+ MimeTypesHandler *handler = MimeTypesHandler::GetHandler(extension);
if (!handler)
continue;
if (handler->CanHandleMIMEType(mime_type)) {
@@ -159,8 +154,7 @@ bool ResourceDispatcherHostDelegateQt::ShouldInterceptResourceAsStream(net::URLR
// Informs the delegate that a Stream was created. The Stream can be read from
// the blob URL of the Stream, but can only be read once.
-void ResourceDispatcherHostDelegateQt::OnStreamCreated(net::URLRequest *request,
- std::unique_ptr<content::StreamInfo> stream)
+void ResourceDispatcherHostDelegateQt::OnStreamCreated(net::URLRequest *request, std::unique_ptr<content::StreamInfo> stream)
{
content::ResourceRequestInfo *info = content::ResourceRequestInfo::ForRequest(request);
std::map<net::URLRequest *, StreamTargetInfo>::iterator ix = stream_target_info_.find(request);
@@ -173,13 +167,10 @@ void ResourceDispatcherHostDelegateQt::OnStreamCreated(net::URLRequest *request,
return;
}
- base::PostTaskWithTraits(
- FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(&OnPdfStreamIntercepted,
- request->url(), ix->second.extension_id,
- info->GetFrameTreeNodeId(), info->GetWebContentsGetterForRequest()
- )
- );
+ base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
+ base::BindOnce(&OnPdfStreamIntercepted,
+ request->url(), ix->second.extension_id,
+ info->GetFrameTreeNodeId(), info->GetWebContentsGetterForRequest()));
stream_target_info_.erase(request);
}
diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
index 3039fd03e..d9ee83581 100644
--- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
+++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h
@@ -47,7 +47,8 @@
namespace QtWebEngineCore {
-class ResourceDispatcherHostDelegateQt : public content::ResourceDispatcherHostDelegate {
+class ResourceDispatcherHostDelegateQt : public content::ResourceDispatcherHostDelegate
+{
public:
// If the stream will be rendered in a BrowserPlugin, |payload| will contain
// the data that should be given to the old ResourceHandler to forward to the
@@ -61,15 +62,16 @@ public:
// the blob URL of the Stream, but can only be read once.
void OnStreamCreated(net::URLRequest *request,
std::unique_ptr<content::StreamInfo> stream) override;
+
private:
#if BUILDFLAG(ENABLE_EXTENSIONS)
- struct StreamTargetInfo {
+ struct StreamTargetInfo
+ {
std::string extension_id;
std::string view_id;
};
std::map<net::URLRequest *, StreamTargetInfo> stream_target_info_;
#endif
-
};
} // namespace QtWebEngineCore
diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp
index ed4d736f2..96625c13f 100644
--- a/src/core/renderer_host/user_resource_controller_host.cpp
+++ b/src/core/renderer_host/user_resource_controller_host.cpp
@@ -51,39 +51,37 @@
namespace QtWebEngineCore {
-class UserResourceControllerHost::WebContentsObserverHelper : public content::WebContentsObserver {
+class UserResourceControllerHost::WebContentsObserverHelper : public content::WebContentsObserver
+{
public:
WebContentsObserverHelper(UserResourceControllerHost *, content::WebContents *);
// WebContentsObserver overrides:
void RenderFrameCreated(content::RenderFrameHost *renderFrameHost) override;
- void RenderFrameHostChanged(content::RenderFrameHost *oldHost,
- content::RenderFrameHost *newHost) override;
+ void RenderFrameHostChanged(content::RenderFrameHost *oldHost, content::RenderFrameHost *newHost) override;
void WebContentsDestroyed() override;
private:
UserResourceControllerHost *m_controllerHost;
};
-UserResourceControllerHost::WebContentsObserverHelper::WebContentsObserverHelper(UserResourceControllerHost *controller, content::WebContents *contents)
- : content::WebContentsObserver(contents)
- , m_controllerHost(controller)
+UserResourceControllerHost::WebContentsObserverHelper::WebContentsObserverHelper(UserResourceControllerHost *controller,
+ content::WebContents *contents)
+ : content::WebContentsObserver(contents)
+ , m_controllerHost(controller)
{
}
-void UserResourceControllerHost::WebContentsObserverHelper::RenderFrameCreated(
- content::RenderFrameHost *renderFrameHost)
+void UserResourceControllerHost::WebContentsObserverHelper::RenderFrameCreated(content::RenderFrameHost *renderFrameHost)
{
content::WebContents *contents = web_contents();
const QList<UserScript> scripts = m_controllerHost->m_perContentsScripts.value(contents);
for (const UserScript &script : scripts)
- renderFrameHost->Send(new RenderFrameObserverHelper_AddScript(
- renderFrameHost->GetRoutingID(), script.data()));
+ renderFrameHost->Send(new RenderFrameObserverHelper_AddScript(renderFrameHost->GetRoutingID(), script.data()));
}
-void UserResourceControllerHost::WebContentsObserverHelper::RenderFrameHostChanged(
- content::RenderFrameHost *oldHost,
- content::RenderFrameHost *newHost)
+void UserResourceControllerHost::WebContentsObserverHelper::RenderFrameHostChanged(content::RenderFrameHost *oldHost,
+ content::RenderFrameHost *newHost)
{
if (oldHost)
oldHost->Send(new RenderFrameObserverHelper_ClearScripts(oldHost->GetRoutingID()));
@@ -95,10 +93,12 @@ void UserResourceControllerHost::WebContentsObserverHelper::WebContentsDestroyed
delete this;
}
-class UserResourceControllerHost::RenderProcessObserverHelper : public content::RenderProcessHostObserver {
+class UserResourceControllerHost::RenderProcessObserverHelper : public content::RenderProcessHostObserver
+{
public:
RenderProcessObserverHelper(UserResourceControllerHost *);
void RenderProcessHostDestroyed(content::RenderProcessHost *) override;
+
private:
UserResourceControllerHost *m_controllerHost;
};
@@ -142,9 +142,9 @@ void UserResourceControllerHost::addUserScript(const UserScript &script, WebCont
}
}
contents->GetRenderViewHost()->Send(
- new RenderFrameObserverHelper_AddScript(
- contents->GetRenderViewHost()->GetMainFrame()->GetRoutingID(),
- script.data()));
+ new RenderFrameObserverHelper_AddScript(
+ contents->GetRenderViewHost()->GetMainFrame()->GetRoutingID(),
+ script.data()));
}
}
@@ -165,8 +165,7 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC
return false;
const bool isProfileWideScript = !adapter;
if (isProfileWideScript) {
- QList<UserScript>::iterator it
- = std::find(m_profileWideScripts.begin(), m_profileWideScripts.end(), script);
+ QList<UserScript>::iterator it = std::find(m_profileWideScripts.begin(), m_profileWideScripts.end(), script);
if (it == m_profileWideScripts.end())
return false;
for (content::RenderProcessHost *renderer : qAsConst(m_observedProcesses))
@@ -181,9 +180,7 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC
if (it == list.end())
return false;
contents->GetRenderViewHost()->Send(
- new RenderFrameObserverHelper_RemoveScript(
- contents->GetMainFrame()->GetRoutingID(),
- (*it).data()));
+ new RenderFrameObserverHelper_RemoveScript(contents->GetMainFrame()->GetRoutingID(), (*it).data()));
list.erase(it);
}
return true;
@@ -200,7 +197,7 @@ void UserResourceControllerHost::clearAllScripts(WebContentsAdapter *adapter)
content::WebContents *contents = adapter->webContents();
m_perContentsScripts.remove(contents);
contents->GetRenderViewHost()->Send(
- new RenderFrameObserverHelper_ClearScripts(contents->GetMainFrame()->GetRoutingID()));
+ new RenderFrameObserverHelper_ClearScripts(contents->GetMainFrame()->GetRoutingID()));
}
}
diff --git a/src/core/renderer_host/user_resource_controller_host.h b/src/core/renderer_host/user_resource_controller_host.h
index 16a73f5fb..9d828feb6 100644
--- a/src/core/renderer_host/user_resource_controller_host.h
+++ b/src/core/renderer_host/user_resource_controller_host.h
@@ -66,7 +66,8 @@ namespace QtWebEngineCore {
class WebContentsAdapter;
-class Q_WEBENGINECORE_PRIVATE_EXPORT UserResourceControllerHost {
+class Q_WEBENGINECORE_PRIVATE_EXPORT UserResourceControllerHost
+{
public:
UserResourceControllerHost();
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
index 4547b7fcf..6dbf2a370 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
@@ -61,7 +61,7 @@ inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame)
return stream << "frame " << frame->GetRoutingID() << " in process " << frame->GetProcess()->GetID();
}
-template <class T>
+template<class T>
inline QDebug operator<<(QDebug stream, const base::Optional<T> &opt)
{
if (opt)
@@ -140,8 +140,7 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uin
return;
}
- QJsonDocument doc = QJsonDocument::fromRawData(
- reinterpret_cast<const char *>(binaryJson.data()), binaryJson.size());
+ QJsonDocument doc = QJsonDocument::fromRawData(reinterpret_cast<const char *>(binaryJson.data()), binaryJson.size());
if (!doc.isObject()) {
qCCritical(log).nospace() << "received invalid webchannel message from " << frame;
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.h b/src/core/renderer_host/web_channel_ipc_transport_host.h
index 94891f25f..d53b24b6b 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.h
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.h
@@ -53,9 +53,11 @@ QT_FORWARD_DECLARE_CLASS(QString)
namespace QtWebEngineCore {
-class WebChannelIPCTransportHost : public QWebChannelAbstractTransport
+class WebChannelIPCTransportHost
+ : public QWebChannelAbstractTransport
, private content::WebContentsObserver
- , qtwebchannel::mojom::WebChannelTransportHost {
+ , qtwebchannel::mojom::WebChannelTransportHost
+{
public:
WebChannelIPCTransportHost(content::WebContents *webContents, uint32_t worldId = 0, QObject *parent = nullptr);
~WebChannelIPCTransportHost() override;