Skip to content

Commit da55882

Browse files
Michal Klocekpatricia-gallardo
authored andcommitted
Migrate user script IPC to mojo
Use mojo instead of old IPC, keep current design and use two interfaces one global and one per frame for now, also use in both cases associated interface with ipc channel otherwise script can be added during the page load, which will radomly brake tests. This change moves UserDataScript to chromium since mojo binding generation did not work correctly. Use StructTraits when serializing the class. Change-Id: I7073fb831c96849e47864382188300db3c9137d9 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 5f10740 commit da55882

13 files changed

+158
-241
lines changed

src/core/common/qt_messages.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99
#include "content/public/common/webplugininfo.h"
1010
#include "ipc/ipc_message_macros.h"
1111
#include "ppapi/buildflags/buildflags.h"
12-
#include "user_script_data.h"
13-
14-
IPC_STRUCT_TRAITS_BEGIN(UserScriptData)
15-
IPC_STRUCT_TRAITS_MEMBER(source)
16-
IPC_STRUCT_TRAITS_MEMBER(url)
17-
IPC_STRUCT_TRAITS_MEMBER(injectionPoint)
18-
IPC_STRUCT_TRAITS_MEMBER(injectForSubframes)
19-
IPC_STRUCT_TRAITS_MEMBER(worldId)
20-
IPC_STRUCT_TRAITS_MEMBER(scriptId)
21-
IPC_STRUCT_TRAITS_MEMBER(globs)
22-
IPC_STRUCT_TRAITS_MEMBER(excludeGlobs)
23-
IPC_STRUCT_TRAITS_MEMBER(urlPatterns)
24-
IPC_STRUCT_TRAITS_END()
25-
2612

2713
#define IPC_MESSAGE_START QtMsgStart
2814

@@ -39,17 +25,6 @@ IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentInnerText,
3925
IPC_MESSAGE_ROUTED1(RenderViewObserverQt_SetBackgroundColor,
4026
uint32_t /* color */)
4127

42-
// User scripts messages
43-
IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_AddScript,
44-
UserScriptData /* script */)
45-
IPC_MESSAGE_ROUTED1(RenderFrameObserverHelper_RemoveScript,
46-
UserScriptData /* script */)
47-
IPC_MESSAGE_ROUTED0(RenderFrameObserverHelper_ClearScripts)
48-
49-
IPC_MESSAGE_CONTROL1(UserResourceController_AddScript, UserScriptData /* scriptContents */)
50-
IPC_MESSAGE_CONTROL1(UserResourceController_RemoveScript, UserScriptData /* scriptContents */)
51-
IPC_MESSAGE_CONTROL0(UserResourceController_ClearScripts)
52-
5328
// Tells the renderer whether or not a file system access has been allowed.
5429
IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestFileSystemAccessAsyncResponse,
5530
int /* request_id */,

src/core/common/user_script_data.cpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/core/common/user_script_data.h

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/core/core_chromium.pri

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ SOURCES = \
5252
color_chooser_controller.cpp \
5353
common/qt_ipc_logging.cpp \
5454
common/qt_messages.cpp \
55-
common/user_script_data.cpp \
5655
compositor/content_gpu_client_qt.cpp \
5756
compositor/display_frame_sink.cpp \
5857
compositor/display_overrides.cpp \
@@ -155,7 +154,6 @@ HEADERS = \
155154
color_chooser_controller_p.h \
156155
color_chooser_controller.h \
157156
common/qt_messages.h \
158-
common/user_script_data.h \
159157
compositor/content_gpu_client_qt.h \
160158
compositor/display_frame_sink.h \
161159
compositor/display_software_output_surface.h \

src/core/qtwebengine.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ deps = [
4141
"//ui/accessibility",
4242
"//ui/gl",
4343
"//qtwebengine/browser:interfaces",
44+
"//qtwebengine/userscript",
4445
"//qtwebengine/browser:service_manifests",
4546
"//qtwebengine/common:mojo_bindings",
4647
":qtwebengine_sources",

src/core/renderer/render_thread_observer_qt.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// found in the LICENSE file.
4444

4545
#include "renderer/render_thread_observer_qt.h"
46-
46+
#include "user_resource_controller.h"
4747
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
4848

4949
namespace QtWebEngineCore {
@@ -54,11 +54,15 @@ void RenderThreadObserverQt::RegisterMojoInterfaces(blink::AssociatedInterfaceRe
5454
{
5555
associated_interfaces->AddInterface(
5656
base::Bind(&RenderThreadObserverQt::OnRendererConfigurationAssociatedRequest, base::Unretained(this)));
57+
associated_interfaces->AddInterface(
58+
base::Bind(&UserResourceController::BindReceiver,
59+
base::Unretained(UserResourceController::instance())));
5760
}
5861

5962
void RenderThreadObserverQt::UnregisterMojoInterfaces(blink::AssociatedInterfaceRegistry *associated_interfaces)
6063
{
6164
associated_interfaces->RemoveInterface(qtwebengine::mojom::RendererConfiguration::Name_);
65+
associated_interfaces->RemoveInterface(qtwebengine::mojom::UserResourceController::Name_);
6266
}
6367

6468
void RenderThreadObserverQt::SetInitialConfiguration(bool is_incognito_process)

0 commit comments

Comments
 (0)