Skip to content

Commit 5be48d4

Browse files
author
Michal Klocek
committed
Add proxy resolver service
This adds proxy resolver service as a part of content utility process and pulls in the corresponding change in Chromium. Fixes: QTBUG-69281 Change-Id: Icb2b67e1e506a5b511531322a8c13d7df0e11f9f Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 267dd7f commit 5be48d4

9 files changed

+137
-2
lines changed

src/core/content_browser_client_qt.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#include "services/service_manager/public/cpp/bind_source_info.h"
7777
#include "services/service_manager/public/cpp/binder_registry.h"
7878
#include "services/service_manager/public/cpp/service.h"
79+
#include "services/proxy_resolver/proxy_resolver_service.h"
7980
#include "third_party/WebKit/public/platform/modules/insecure_input/insecure_input_service.mojom.h"
8081
#include "ui/base/resource/resource_bundle.h"
8182
#include "ui/base/ui_base_switches.h"
@@ -104,6 +105,7 @@
104105
#include "quota_permission_context_qt.h"
105106
#include "renderer_host/resource_dispatcher_host_delegate_qt.h"
106107
#include "renderer_host/user_resource_controller_host.h"
108+
#include "type_conversion.h"
107109
#include "web_contents_delegate_qt.h"
108110
#include "web_engine_context.h"
109111
#include "web_engine_library_info.h"
@@ -681,6 +683,11 @@ void ContentBrowserClientQt::RegisterInProcessServices(StaticServiceMap* service
681683
services->insert(std::make_pair("qtwebengine", info));
682684
}
683685

686+
void ContentBrowserClientQt::RegisterOutOfProcessServices(content::ContentBrowserClient::OutOfProcessServiceMap *services)
687+
{
688+
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] = toString16(QLatin1String("V8 Proxy Resolver"));
689+
}
690+
684691
std::unique_ptr<base::Value> ContentBrowserClientQt::GetServiceManifestOverlay(base::StringPiece name)
685692
{
686693
ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance();

src/core/content_browser_client_qt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient {
119119
const std::string& interface_name,
120120
mojo::ScopedMessagePipeHandle interface_pipe) override;
121121
void RegisterInProcessServices(StaticServiceMap* services) override;
122+
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
122123
std::unique_ptr<base::Value> GetServiceManifestOverlay(base::StringPiece name) override;
123124
bool CanCreateWindow(
124125
content::RenderFrameHost* opener,

src/core/content_main_delegate_qt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie
184184
return new ContentRendererClientQt;
185185
}
186186

187+
content::ContentUtilityClient *ContentMainDelegateQt::CreateContentUtilityClient()
188+
{
189+
m_utilityClient.reset(new ContentUtilityClientQt);
190+
return m_utilityClient.get();
191+
}
192+
187193
// see icu_util.cc
188194
#define ICU_UTIL_DATA_FILE 0
189195
#define ICU_UTIL_DATA_SHARED 1

src/core/content_main_delegate_qt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "content/public/app/content_main_delegate.h"
4444

4545
#include "content_browser_client_qt.h"
46+
#include "content_utility_client_qt.h"
4647

4748
namespace QtWebEngineCore {
4849

@@ -56,11 +57,12 @@ class ContentMainDelegateQt : public content::ContentMainDelegate
5657

5758
content::ContentBrowserClient* CreateContentBrowserClient() override;
5859
content::ContentRendererClient* CreateContentRendererClient() override;
59-
60+
content::ContentUtilityClient* CreateContentUtilityClient() override;
6061
bool BasicStartupComplete(int* /*exit_code*/) override;
6162

6263
private:
6364
std::unique_ptr<ContentBrowserClientQt> m_browserClient;
65+
std::unique_ptr<ContentUtilityClientQt> m_utilityClient;
6466
};
6567

6668
} // namespace QtWebEngineCore
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/****************************************************************************
2+
**
3+
** Copyright (C) 2018 The Qt Company Ltd.
4+
** Contact: https://www.qt.io/licensing/
5+
**
6+
** This file is part of the QtWebEngine module of the Qt Toolkit.
7+
**
8+
** $QT_BEGIN_LICENSE:LGPL$
9+
** Commercial License Usage
10+
** Licensees holding valid commercial Qt licenses may use this file in
11+
** accordance with the commercial license agreement provided with the
12+
** Software or, alternatively, in accordance with the terms contained in
13+
** a written agreement between you and The Qt Company. For licensing terms
14+
** and conditions see https://www.qt.io/terms-conditions. For further
15+
** information use the contact form at https://www.qt.io/contact-us.
16+
**
17+
** GNU Lesser General Public License Usage
18+
** Alternatively, this file may be used under the terms of the GNU Lesser
19+
** General Public License version 3 as published by the Free Software
20+
** Foundation and appearing in the file LICENSE.LGPL3 included in the
21+
** packaging of this file. Please review the following information to
22+
** ensure the GNU Lesser General Public License version 3 requirements
23+
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24+
**
25+
** GNU General Public License Usage
26+
** Alternatively, this file may be used under the terms of the GNU
27+
** General Public License version 2.0 or (at your option) the GNU General
28+
** Public license version 3 or any later version approved by the KDE Free
29+
** Qt Foundation. The licenses are as published by the Free Software
30+
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31+
** included in the packaging of this file. Please review the following
32+
** information to ensure the GNU General Public License requirements will
33+
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34+
** https://www.gnu.org/licenses/gpl-3.0.html.
35+
**
36+
** $QT_END_LICENSE$
37+
**
38+
****************************************************************************/
39+
40+
#include "content_utility_client_qt.h"
41+
42+
#include "content/public/utility/utility_thread.h"
43+
#include "services/proxy_resolver/proxy_resolver_service.h"
44+
45+
ContentUtilityClientQt::ContentUtilityClientQt() {
46+
}
47+
48+
ContentUtilityClientQt::~ContentUtilityClientQt() = default;
49+
50+
51+
void ContentUtilityClientQt::RegisterServices(
52+
ContentUtilityClient::StaticServiceMap* services) {
53+
service_manager::EmbeddedServiceInfo proxy_resolver_info;
54+
proxy_resolver_info.task_runner =
55+
content::ChildThread::Get()->GetIOTaskRunner();
56+
proxy_resolver_info.factory =
57+
base::Bind(&proxy_resolver::ProxyResolverService::CreateService);
58+
services->emplace(proxy_resolver::mojom::kProxyResolverServiceName,
59+
proxy_resolver_info);
60+
}

src/core/content_utility_client_qt.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/****************************************************************************
2+
**
3+
** Copyright (C) 2018 The Qt Company Ltd.
4+
** Contact: https://www.qt.io/licensing/
5+
**
6+
** This file is part of the QtWebEngine module of the Qt Toolkit.
7+
**
8+
** $QT_BEGIN_LICENSE:LGPL$
9+
** Commercial License Usage
10+
** Licensees holding valid commercial Qt licenses may use this file in
11+
** accordance with the commercial license agreement provided with the
12+
** Software or, alternatively, in accordance with the terms contained in
13+
** a written agreement between you and The Qt Company. For licensing terms
14+
** and conditions see https://www.qt.io/terms-conditions. For further
15+
** information use the contact form at https://www.qt.io/contact-us.
16+
**
17+
** GNU Lesser General Public License Usage
18+
** Alternatively, this file may be used under the terms of the GNU Lesser
19+
** General Public License version 3 as published by the Free Software
20+
** Foundation and appearing in the file LICENSE.LGPL3 included in the
21+
** packaging of this file. Please review the following information to
22+
** ensure the GNU Lesser General Public License version 3 requirements
23+
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24+
**
25+
** GNU General Public License Usage
26+
** Alternatively, this file may be used under the terms of the GNU
27+
** General Public License version 2.0 or (at your option) the GNU General
28+
** Public license version 3 or any later version approved by the KDE Free
29+
** Qt Foundation. The licenses are as published by the Free Software
30+
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31+
** included in the packaging of this file. Please review the following
32+
** information to ensure the GNU General Public License requirements will
33+
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34+
** https://www.gnu.org/licenses/gpl-3.0.html.
35+
**
36+
** $QT_END_LICENSE$
37+
**
38+
****************************************************************************/
39+
40+
#ifndef CONTENT_UTILITY_CLIENT_QT_H
41+
#define CONTENT_UTILITY_CLIENT_QT_H
42+
#include "content/public/utility/content_utility_client.h"
43+
44+
class MashServiceFactory;
45+
class UtilityMessageHandler;
46+
47+
class ContentUtilityClientQt : public content::ContentUtilityClient {
48+
public:
49+
ContentUtilityClientQt();
50+
~ContentUtilityClientQt() override;
51+
52+
// content::ContentUtilityClient:
53+
void RegisterServices(StaticServiceMap* services) override;
54+
};
55+
56+
#endif

src/core/core_chromium.pri

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ SOURCES = \
5555
content_client_qt.cpp \
5656
content_browser_client_qt.cpp \
5757
content_main_delegate_qt.cpp \
58+
content_utility_client_qt.cpp \
5859
delegated_frame_node.cpp \
5960
desktop_screen_qt.cpp \
6061
devtools_frontend_qt.cpp \
@@ -140,6 +141,7 @@ HEADERS = \
140141
content_client_qt.h \
141142
content_browser_client_qt.h \
142143
content_main_delegate_qt.h \
144+
content_utility_client_qt.h \
143145
delegated_frame_node.h \
144146
desktop_screen_qt.h \
145147
devtools_frontend_qt.h \

src/core/qtwebengine.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ deps = [
3131
"//third_party/WebKit/public:blink",
3232
"//ui/accessibility",
3333
"//third_party/mesa:mesa_headers",
34+
"//services/proxy_resolver:lib",
3435
":qtwebengine_sources",
3536
":qtwebengine_resources"
3637
]

0 commit comments

Comments
 (0)