Commit 0a95f639 authored by Antia Puentes's avatar Antia Puentes Committed by Chromium LUCI CQ

Migrate ExtensionMsg_SetSystemFont IPC to mojo

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

Bug: 1165812
Change-Id: Id53cdd68da19509682067a067ff544ff04128c87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627410Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Antia Puentes <apuentes@igalia.com>
Cr-Commit-Position: refs/heads/master@{#843443}
parent 09ef3fc2
...@@ -83,7 +83,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper, ...@@ -83,7 +83,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper,
void SetSessionInfo(version_info::Channel channel, void SetSessionInfo(version_info::Channel channel,
mojom::FeatureSessionType session, mojom::FeatureSessionType session,
bool is_lock_screen_context) override {} bool is_lock_screen_context) override {}
void SetSystemFont(const std::string& font_family,
const std::string& font_size) override {}
mojo::AssociatedReceiverSet<mojom::Renderer> receivers_; mojo::AssociatedReceiverSet<mojom::Renderer> receivers_;
}; };
......
...@@ -127,8 +127,7 @@ void RendererStartupHelper::InitializeProcess( ...@@ -127,8 +127,7 @@ void RendererStartupHelper::InitializeProcess(
// Platform apps need to know the system font. // Platform apps need to know the system font.
// TODO(dbeam): this is not the system font in all cases. // TODO(dbeam): this is not the system font in all cases.
process->Send(new ExtensionMsg_SetSystemFont(webui::GetFontFamily(), renderer->SetSystemFont(webui::GetFontFamily(), webui::GetFontSize());
webui::GetFontSize()));
// Scripting allowlist. This is modified by tests and must be communicated // Scripting allowlist. This is modified by tests and must be communicated
// to renderers. // to renderers.
......
...@@ -54,6 +54,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper, ...@@ -54,6 +54,8 @@ class InterceptingRendererStartupHelper : public RendererStartupHelper,
void SetSessionInfo(version_info::Channel channel, void SetSessionInfo(version_info::Channel channel,
mojom::FeatureSessionType session, mojom::FeatureSessionType session,
bool is_lock_screen_context) override {} bool is_lock_screen_context) override {}
void SetSystemFont(const std::string& font_family,
const std::string& font_size) 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_;
......
...@@ -568,11 +568,6 @@ IPC_MESSAGE_ROUTED4(ExtensionMsg_MessageInvoke, ...@@ -568,11 +568,6 @@ IPC_MESSAGE_ROUTED4(ExtensionMsg_MessageInvoke,
IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName, IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName,
std::string /* frame_name */) std::string /* frame_name */)
// Tell the renderer process the platforms system font.
IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont,
std::string /* font_family */,
std::string /* font_size */)
// Notifies the renderer that extensions were loaded in the browser. // Notifies the renderer that extensions were loaded in the browser.
IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded, IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
std::vector<ExtensionMsg_Loaded_Params>) std::vector<ExtensionMsg_Loaded_Params>)
......
...@@ -30,4 +30,7 @@ interface Renderer { ...@@ -30,4 +30,7 @@ interface Renderer {
SetSessionInfo(Channel channel, SetSessionInfo(Channel channel,
FeatureSessionType session, FeatureSessionType session,
bool is_lock_screen_context); bool is_lock_screen_context);
// Tells the renderer process the platform's system font.
SetSystemFont(string font_family, string font_size);
}; };
...@@ -876,7 +876,6 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { ...@@ -876,7 +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_SetSystemFont, OnSetSystemFont)
IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID, IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID,
OnSetWebViewPartitionID) OnSetWebViewPartitionID)
IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend)
...@@ -1009,6 +1008,12 @@ void Dispatcher::UnloadExtension(const std::string& extension_id) { ...@@ -1009,6 +1008,12 @@ void Dispatcher::UnloadExtension(const std::string& extension_id) {
// extension's URL just won't match anything anymore. // extension's URL just won't match anything anymore.
} }
void Dispatcher::SetSystemFont(const std::string& font_family,
const std::string& font_size) {
system_font_family_ = font_family;
system_font_size_ = font_size;
}
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);
...@@ -1180,12 +1185,6 @@ void Dispatcher::OnSetScriptingAllowlist( ...@@ -1180,12 +1185,6 @@ void Dispatcher::OnSetScriptingAllowlist(
ExtensionsClient::Get()->SetScriptingAllowlist(extension_ids); ExtensionsClient::Get()->SetScriptingAllowlist(extension_ids);
} }
void Dispatcher::OnSetSystemFont(const std::string& font_family,
const std::string& font_size) {
system_font_family_ = font_family;
system_font_size_ = font_size;
}
void Dispatcher::OnSetWebViewPartitionID(const std::string& partition_id) { void Dispatcher::OnSetWebViewPartitionID(const std::string& partition_id) {
// |webview_partition_id_| cannot be changed once set. // |webview_partition_id_| cannot be changed once set.
CHECK(webview_partition_id_.empty() || webview_partition_id_ == partition_id); CHECK(webview_partition_id_.empty() || webview_partition_id_ == partition_id);
......
...@@ -220,7 +220,8 @@ class Dispatcher : public content::RenderThreadObserver, ...@@ -220,7 +220,8 @@ class Dispatcher : public content::RenderThreadObserver,
void SetSessionInfo(version_info::Channel channel, void SetSessionInfo(version_info::Channel channel,
mojom::FeatureSessionType session_type, mojom::FeatureSessionType session_type,
bool lock_screen_context) override; bool lock_screen_context) override;
void SetSystemFont(const std::string& font_family,
const std::string& font_size) 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);
...@@ -245,8 +246,6 @@ class Dispatcher : public content::RenderThreadObserver, ...@@ -245,8 +246,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 OnSetSystemFont(const std::string& font_family,
const std::string& font_size);
void OnSetWebViewPartitionID(const std::string& partition_id); 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);
......
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