feat: add APIs to enable/disable spell checker (#26276)
* feat: add APIs to enable/disable bulitin spell checker * feat: add togglespellchecker menu item role
This commit is contained in:
parent
f77b56e926
commit
bb3fb548d8
9 changed files with 97 additions and 5 deletions
|
@ -1077,6 +1077,17 @@ bool Session::RemoveWordFromSpellCheckerDictionary(const std::string& word) {
|
|||
#endif
|
||||
return service->GetCustomDictionary()->RemoveWord(word);
|
||||
}
|
||||
|
||||
void Session::SetSpellCheckerEnabled(bool b) {
|
||||
browser_context_->prefs()->SetBoolean(spellcheck::prefs::kSpellCheckEnable,
|
||||
b);
|
||||
}
|
||||
|
||||
bool Session::IsSpellCheckerEnabled() const {
|
||||
return browser_context_->prefs()->GetBoolean(
|
||||
spellcheck::prefs::kSpellCheckEnable);
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
|
||||
// static
|
||||
|
@ -1179,6 +1190,10 @@ gin::ObjectTemplateBuilder Session::GetObjectTemplateBuilder(
|
|||
&Session::AddWordToSpellCheckerDictionary)
|
||||
.SetMethod("removeWordFromSpellCheckerDictionary",
|
||||
&Session::RemoveWordFromSpellCheckerDictionary)
|
||||
.SetMethod("setSpellCheckerEnabled", &Session::SetSpellCheckerEnabled)
|
||||
.SetMethod("isSpellCheckerEnabled", &Session::IsSpellCheckerEnabled)
|
||||
.SetProperty("spellCheckerEnabled", &Session::IsSpellCheckerEnabled,
|
||||
&Session::SetSpellCheckerEnabled)
|
||||
#endif
|
||||
.SetMethod("preconnect", &Session::Preconnect)
|
||||
.SetMethod("closeAllConnections", &Session::CloseAllConnections)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue