mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
* chore: bump chromium in DEPS to 144.0.7543.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * Pass PipScreenCaptureCoordinatorProxy to ScreenCaptureKitDeviceMac https://chromium-review.googlesource.com/c/chromium/src/+/7157590 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update patches Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: update filenames.libcxx.gni Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 7142359: Spanification of process_singleton_posix.cc https: //chromium-review.googlesource.com/c/chromium/src/+/7142359 Co-Authored-By: Charles Kerr <70381+ckerr@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Move logging::LoggingSettings to base/logging/logging_settings.h https://chromium-review.googlesource.com/c/chromium/src/+/7173024 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: bump chromium in DEPS to 144.0.7545.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * 7159368: update PluginService API for sync GetPlugins Upstream removed async PluginService APIs: - GetPluginsAsync() removed, use synchronous GetPlugins() - RegisterInternalPlugin() now takes single argument (remove add_at_beginning) - RefreshPlugins() removed entirely Updated ElectronPluginInfoHostImpl to use synchronous plugin loading and simplified ElectronBrowserMainParts internal plugin registration. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159368 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159328 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159056 (cherry picked from commit88cdf50b0a) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 7159184: add missing base/files/file_path.h include Add explicit include for base/files/file_path.h in electron_browser_context.h. After removal of superfluous Mojo includes from content headers, base::FilePath is no longer transitively included via content/public/browser/browser_context.h. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159184 (cherry picked from commit6ca8ea03ec) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 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 (cherry picked from commit879c0401c4) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 7083663: remove fingerprinting_protection_ruleset_service override Upstream deleted external references to Fingerprinting Protection Filter (FPF) component. Remove the fingerprinting_protection_ruleset_service() override from BrowserProcessImpl as the method no longer exists in the base class. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7083663 (cherry picked from commit8350d152f9) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 7155287: implement WebContentsView::GetSize and Resize Upstream delegated WebContents::GetSize() and Resize() to WebContentsView, making them pure virtual. Add const qualifier to GetSize() and implement the Resize() override in OffScreenWebContentsView (no-op for offscreen). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7155287 (cherry picked from commit084eaa568e) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 7184238: add OnUnconfirmedTapConvertedToTap override Upstream added OnUnconfirmedTapConvertedToTap as a pure virtual method to RenderWidgetHostViewBase to inform root view when child frame converts an unconfirmed tap. Add empty override for offscreen rendering. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7184238 (cherry picked from commitef03400d9a) Co-authored-by: Samuel Attard <sattard@anthropic.com> * 7143586: add widget parameter to OnCommandsChanged GlobalAcceleratorListener::OnCommandsChanged gained a gfx::AcceleratedWidget parameter for window association in the GlobalShortcutListenerLinux implementation. Pass gfx::kNullAcceleratedWidget for Electron's usage. Ref: : Pass parent handle to GlobalAcceleratorListenerLinux::BindShortcuts | https://chromium-review.googlesource.com/c/chromium/src/+/7143586 (cherry picked from commit38306e2bfc) Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@anthropic.com> * chore: update patches Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: bump chromium in DEPS to 144.0.7547.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * chore: update patches Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 7189232: Add support for UnownedUserData in GlobalFeatures https: //chromium-review.googlesource.com/c/chromium/src/+/7189232 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Refactor: Use std::u16string for extension load error messages https://chromium-review.googlesource.com/c/chromium/src/+/7185844 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup Add support for UnownedUserData in GlobalFeatures Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 7165650: Remove ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/7165650 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup BUILD.gn for lint Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * 7202164: Reland "Reland "Remove GenericScopedHandle:IsValid"" https://chromium-review.googlesource.com/c/chromium/src/+/7202164 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * advance deprecation of v8::ReturnValue<void>::Set(Local<S>). 7168624: [runtime][api] Relax requirements for setter/definer/deleter callbacks | https://chromium-review.googlesource.com/c/v8/v8/+/7168624 Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * fixup advance deprecation of v8::ReturnValue<void>::Set(Local<S>) Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * chore: skip setting LPAC ACLs Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Revert "chore: skip setting LPAC ACLs" This reverts commite187aec488. Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * chore: revert Convert to UNSAFE_TODO in sandbox revert https://chromium-review.googlesource.com/c/chromium/src/+/7131661 to see if it fixes the Windows sandbox issue. Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * Revert "chore: revert Convert to UNSAFE_TODO in sandbox" This reverts commit57afbfefe5. Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * chore: Revert "Enable network sandbox by default on Windows" see if this fixes the Windows sandbox issue Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * Enable network sandbox by default on Windows https://chromium-review.googlesource.com/c/chromium/src/+/7204292 Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * Revert "chore: Revert "Enable network sandbox by default on Windows"" This reverts commit530ab6af82. Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * fixup! Enable network sandbox by default on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/7204292 Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * fixup!: Correct flag name, add kLocalNetworkAccessChecks to all platforms Co-authored-by: Keeley Hammond <khammond@slack-corp.com> * chore: remove patch that hasn't been backported See https://github.com/electron/electron/pull/48675 --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Samuel Attard <sattard@anthropic.com> Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: Niklas Wenzel <dev@nikwen.de>
117 lines
4.2 KiB
C++
117 lines
4.2 KiB
C++
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ELECTRON_SHELL_RENDERER_API_ELECTRON_API_SPELL_CHECK_CLIENT_H_
|
|
#define ELECTRON_SHELL_RENDERER_API_ELECTRON_API_SPELL_CHECK_CLIENT_H_
|
|
|
|
#include <memory>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/memory/raw_ptr.h"
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "components/spellcheck/renderer/spellcheck_worditerator.h"
|
|
#include "third_party/blink/public/platform/web_spell_check_panel_host_client.h"
|
|
#include "third_party/blink/public/web/web_text_check_client.h"
|
|
#include "v8/include/v8-context.h"
|
|
#include "v8/include/v8-forward.h"
|
|
#include "v8/include/v8-local-handle.h"
|
|
|
|
namespace blink {
|
|
struct WebTextCheckingResult;
|
|
class WebTextCheckingCompletion;
|
|
} // namespace blink
|
|
|
|
namespace electron::api {
|
|
|
|
class SpellCheckClient : public blink::WebSpellCheckPanelHostClient,
|
|
public blink::WebTextCheckClient {
|
|
public:
|
|
SpellCheckClient(const std::string& language,
|
|
v8::Isolate* isolate,
|
|
v8::Local<v8::Object> provider);
|
|
~SpellCheckClient() override;
|
|
|
|
// disable copy
|
|
SpellCheckClient(const SpellCheckClient&) = delete;
|
|
SpellCheckClient& operator=(const SpellCheckClient&) = delete;
|
|
|
|
private:
|
|
class SpellcheckRequest;
|
|
// blink::WebTextCheckClient:
|
|
void RequestCheckingOfText(
|
|
const blink::WebString& text_to_check,
|
|
ShouldForceRefreshTextCheckService should_force_refresh,
|
|
std::unique_ptr<blink::WebTextCheckingCompletion> completion_callback)
|
|
override;
|
|
bool IsSpellCheckingEnabled() const override;
|
|
|
|
// blink::WebSpellCheckPanelHostClient:
|
|
void ShowSpellingUI(bool show) override {}
|
|
bool IsShowingSpellingUI() override;
|
|
void UpdateSpellingUIWithMisspelledWord(
|
|
const blink::WebString& word) override {}
|
|
|
|
struct SpellCheckScope {
|
|
v8::HandleScope handle_scope_;
|
|
v8::Context::Scope context_scope_;
|
|
v8::Local<v8::Object> provider_;
|
|
v8::Local<v8::Function> spell_check_;
|
|
|
|
explicit SpellCheckScope(const SpellCheckClient& client);
|
|
~SpellCheckScope();
|
|
};
|
|
|
|
// Run through the word iterator and send out requests
|
|
// to the JS API for checking spellings of words in the current
|
|
// request.
|
|
void SpellCheckText();
|
|
|
|
// Call JavaScript to check spelling a word.
|
|
// The javascript function will callback OnSpellCheckDone
|
|
// with the results of all the misspelled words.
|
|
void SpellCheckWords(const SpellCheckScope& scope,
|
|
const std::set<std::u16string>& words);
|
|
|
|
// Returns whether or not the given word is a contraction of valid words
|
|
// (e.g. "word:word").
|
|
// Output variable contraction_words will contain individual
|
|
// words in the contraction.
|
|
bool IsContraction(const SpellCheckScope& scope,
|
|
const std::u16string& contraction,
|
|
std::vector<std::u16string>* contraction_words);
|
|
|
|
// Callback for the JS API which returns the list of misspelled words.
|
|
void OnSpellCheckDone(const std::vector<std::u16string>& misspelled_words);
|
|
|
|
// Represents character attributes used for filtering out characters which
|
|
// are not supported by this SpellCheck object.
|
|
SpellcheckCharAttribute character_attributes_;
|
|
|
|
// Represents word iterators used in this spellchecker. The |text_iterator_|
|
|
// splits text provided by Blink into words, contractions, or concatenated
|
|
// words. The |contraction_iterator_| splits a concatenated word extracted by
|
|
// |text_iterator_| into word components so we can treat a concatenated word
|
|
// consisting only of correct words as a correct word.
|
|
SpellcheckWordIterator text_iterator_;
|
|
SpellcheckWordIterator contraction_iterator_;
|
|
|
|
// The parameters of a pending background-spellchecking request.
|
|
// (When Blink sends two or more requests, we cancel the previous
|
|
// requests so we do not have to use vectors.)
|
|
std::unique_ptr<SpellcheckRequest> pending_request_param_;
|
|
|
|
raw_ptr<v8::Isolate> isolate_;
|
|
v8::Global<v8::Context> context_;
|
|
v8::Global<v8::Object> provider_;
|
|
v8::Global<v8::Function> spell_check_;
|
|
|
|
base::WeakPtrFactory<SpellCheckClient> weak_factory_{this};
|
|
};
|
|
|
|
} // namespace electron::api
|
|
|
|
#endif // ELECTRON_SHELL_RENDERER_API_ELECTRON_API_SPELL_CHECK_CLIENT_H_
|