Commit 3d54419e authored by Antia Puentes's avatar Antia Puentes Committed by Chromium LUCI CQ

Migrate ExtensionMsg_SetWebViewPartitionID IPC to mojo

This CL migrates the legacy IPC message out of extension_messages.h to
Renderer mojo interface from extensions.mojom.

Bug: 1165814
Change-Id: I338e9e1e59321d143053ec4c47bed7234c04ae5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627270
Commit-Queue: Antia Puentes <apuentes@igalia.com>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844009}
parent 72fe6d7a
...@@ -85,6 +85,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper, ...@@ -85,6 +85,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper,
bool is_lock_screen_context) override {} bool is_lock_screen_context) override {}
void SetSystemFont(const std::string& font_family, void SetSystemFont(const std::string& font_family,
const std::string& font_size) override {} const std::string& font_size) override {}
void SetWebViewPartitionID(const std::string& partition_id) override {}
mojo::AssociatedReceiverSet<mojom::Renderer> receivers_; mojo::AssociatedReceiverSet<mojom::Renderer> receivers_;
}; };
......
...@@ -138,8 +138,7 @@ void RendererStartupHelper::InitializeProcess( ...@@ -138,8 +138,7 @@ void RendererStartupHelper::InitializeProcess(
// partition ID to it. // partition ID to it.
std::string webview_partition_id = WebViewGuest::GetPartitionID(process); std::string webview_partition_id = WebViewGuest::GetPartitionID(process);
if (!webview_partition_id.empty()) { if (!webview_partition_id.empty()) {
process->Send(new ExtensionMsg_SetWebViewPartitionID( renderer->SetWebViewPartitionID(webview_partition_id);
WebViewGuest::GetPartitionID(process)));
} }
BrowserContext* renderer_context = process->GetBrowserContext(); BrowserContext* renderer_context = process->GetBrowserContext();
......
...@@ -57,6 +57,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper, ...@@ -57,6 +57,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper,
void SetSystemFont(const std::string& font_family, void SetSystemFont(const std::string& font_family,
const std::string& font_size) override {} const std::string& font_size) override {}
void SetWebViewPartitionID(const std::string& partition_id) override {}
std::vector<std::string> activated_extensions_; std::vector<std::string> activated_extensions_;
std::vector<std::string> unloaded_extensions_; std::vector<std::string> unloaded_extensions_;
mojo::AssociatedReceiverSet<mojom::Renderer> receivers_; mojo::AssociatedReceiverSet<mojom::Renderer> receivers_;
......
...@@ -720,10 +720,6 @@ IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages, ...@@ -720,10 +720,6 @@ IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs, IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
std::vector<std::string> /* blob_uuids */) std::vector<std::string> /* blob_uuids */)
// Report the WebView partition ID to the WebView guest renderer process.
IPC_MESSAGE_CONTROL1(ExtensionMsg_SetWebViewPartitionID,
std::string /* webview_partition_id */)
// Enable or disable spatial navigation. // Enable or disable spatial navigation.
IPC_MESSAGE_ROUTED1(ExtensionMsg_SetSpatialNavigationEnabled, IPC_MESSAGE_ROUTED1(ExtensionMsg_SetSpatialNavigationEnabled,
bool /* spatial_nav_enabled */) bool /* spatial_nav_enabled */)
......
...@@ -33,4 +33,7 @@ interface Renderer { ...@@ -33,4 +33,7 @@ interface Renderer {
// Tells the renderer process the platform's system font. // Tells the renderer process the platform's system font.
SetSystemFont(string font_family, string font_size); SetSystemFont(string font_family, string font_size);
// Reports the WebView partition ID to the WebView guest renderer process.
SetWebViewPartitionID(string partition_id);
}; };
...@@ -876,8 +876,6 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { ...@@ -876,8 +876,6 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchEvent, OnDispatchEvent) IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchEvent, OnDispatchEvent)
IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingAllowlist, IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingAllowlist,
OnSetScriptingAllowlist) OnSetScriptingAllowlist)
IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID,
OnSetWebViewPartitionID)
IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend)
IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend)
IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs)
...@@ -1014,6 +1012,12 @@ void Dispatcher::SetSystemFont(const std::string& font_family, ...@@ -1014,6 +1012,12 @@ void Dispatcher::SetSystemFont(const std::string& font_family,
system_font_size_ = font_size; system_font_size_ = font_size;
} }
void Dispatcher::SetWebViewPartitionID(const std::string& partition_id) {
// |webview_partition_id_| cannot be changed once set.
CHECK(webview_partition_id_.empty() || webview_partition_id_ == partition_id);
webview_partition_id_ = partition_id;
}
void Dispatcher::OnCancelSuspend(const std::string& extension_id) { void Dispatcher::OnCancelSuspend(const std::string& extension_id) {
DispatchEvent(extension_id, kOnSuspendCanceledEvent, base::ListValue(), DispatchEvent(extension_id, kOnSuspendCanceledEvent, base::ListValue(),
nullptr); nullptr);
...@@ -1185,12 +1189,6 @@ void Dispatcher::OnSetScriptingAllowlist( ...@@ -1185,12 +1189,6 @@ void Dispatcher::OnSetScriptingAllowlist(
ExtensionsClient::Get()->SetScriptingAllowlist(extension_ids); ExtensionsClient::Get()->SetScriptingAllowlist(extension_ids);
} }
void Dispatcher::OnSetWebViewPartitionID(const std::string& partition_id) {
// |webview_partition_id_| cannot be changed once set.
CHECK(webview_partition_id_.empty() || webview_partition_id_ == partition_id);
webview_partition_id_ = partition_id;
}
void Dispatcher::OnShouldSuspend(const std::string& extension_id, void Dispatcher::OnShouldSuspend(const std::string& extension_id,
uint64_t sequence_id) { uint64_t sequence_id) {
RenderThread::Get()->Send( RenderThread::Get()->Send(
......
...@@ -222,6 +222,7 @@ class Dispatcher : public content::RenderThreadObserver, ...@@ -222,6 +222,7 @@ class Dispatcher : public content::RenderThreadObserver,
bool lock_screen_context) override; bool lock_screen_context) override;
void SetSystemFont(const std::string& font_family, void SetSystemFont(const std::string& font_family,
const std::string& font_size) override; const std::string& font_size) override;
void SetWebViewPartitionID(const std::string& partition_id) override;
void OnRendererAssociatedRequest( void OnRendererAssociatedRequest(
mojo::PendingAssociatedReceiver<mojom::Renderer> receiver); mojo::PendingAssociatedReceiver<mojom::Renderer> receiver);
void OnCancelSuspend(const std::string& extension_id); void OnCancelSuspend(const std::string& extension_id);
...@@ -246,7 +247,6 @@ class Dispatcher : public content::RenderThreadObserver, ...@@ -246,7 +247,6 @@ class Dispatcher : public content::RenderThreadObserver,
const base::ListValue& event_args); const base::ListValue& event_args);
void OnSetScriptingAllowlist( void OnSetScriptingAllowlist(
const ExtensionsClient::ScriptingAllowlist& extension_ids); const ExtensionsClient::ScriptingAllowlist& extension_ids);
void OnSetWebViewPartitionID(const std::string& partition_id);
void OnShouldSuspend(const std::string& extension_id, uint64_t sequence_id); void OnShouldSuspend(const std::string& extension_id, uint64_t sequence_id);
void OnSuspend(const std::string& extension_id); void OnSuspend(const std::string& extension_id);
void OnTransferBlobs(const std::vector<std::string>& blob_uuids); void OnTransferBlobs(const std::vector<std::string>& blob_uuids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment