From 879c0401c46006907e251285ba4a8b9d41742a15 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 24 Nov 2025 16:26:53 -0800 Subject: [PATCH] 7126479: add ShouldForceRefreshTextCheckService parameter to SpellCheckClient Upstream added a force-refresh parameter to WebTextCheckClient::RequestCheckingOfText to bypass spell check cache. Add the new ShouldForceRefreshTextCheckService parameter to SpellCheckClient's override (currently unused in Electron). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7126479 --- shell/renderer/api/electron_api_spell_check_client.cc | 11 ++++++----- shell/renderer/api/electron_api_spell_check_client.h | 8 +++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc index 6af3d87d8f..6478c95ce1 100644 --- a/shell/renderer/api/electron_api_spell_check_client.cc +++ b/shell/renderer/api/electron_api_spell_check_client.cc @@ -90,12 +90,13 @@ SpellCheckClient::~SpellCheckClient() { } void SpellCheckClient::RequestCheckingOfText( - const blink::WebString& textToCheck, - std::unique_ptr completionCallback) { - std::u16string text(textToCheck.Utf16()); + const blink::WebString& text_to_check, + ShouldForceRefreshTextCheckService /* should_force_refresh */, + std::unique_ptr completion_callback) { + std::u16string text(text_to_check.Utf16()); // Ignore invalid requests. if (text.empty() || !HasWordCharacters(text, 0)) { - completionCallback->DidCancelCheckingText(); + completion_callback->DidCancelCheckingText(); return; } @@ -105,7 +106,7 @@ void SpellCheckClient::RequestCheckingOfText( } pending_request_param_ = - std::make_unique(text, std::move(completionCallback)); + std::make_unique(text, std::move(completion_callback)); base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(&SpellCheckClient::SpellCheckText, diff --git a/shell/renderer/api/electron_api_spell_check_client.h b/shell/renderer/api/electron_api_spell_check_client.h index 644f024298..0d6cc56af0 100644 --- a/shell/renderer/api/electron_api_spell_check_client.h +++ b/shell/renderer/api/electron_api_spell_check_client.h @@ -41,9 +41,11 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient, private: class SpellcheckRequest; // blink::WebTextCheckClient: - void RequestCheckingOfText(const blink::WebString& textToCheck, - std::unique_ptr - completionCallback) override; + void RequestCheckingOfText( + const blink::WebString& text_to_check, + ShouldForceRefreshTextCheckService should_force_refresh, + std::unique_ptr completion_callback) + override; bool IsSpellCheckingEnabled() const override; // blink::WebSpellCheckPanelHostClient: