Add option to turn on/off auto correct word

This commit is contained in:
Cheng Zhao 2014-12-19 21:01:47 -08:00
parent f6c66e7ece
commit 90b2d12371
4 changed files with 20 additions and 9 deletions

View file

@ -55,10 +55,13 @@ bool HasWordCharacters(const base::string16& text, int index) {
} // namespace
SpellCheckClient::SpellCheckClient(v8::Isolate* isolate,
const std::string& language,
SpellCheckClient::SpellCheckClient(const std::string& language,
bool auto_spell_correct_turned_on,
v8::Isolate* isolate,
v8::Handle<v8::Object> provider)
: isolate_(isolate), provider_(isolate, provider) {
: auto_spell_correct_turned_on_(auto_spell_correct_turned_on),
isolate_(isolate),
provider_(isolate, provider) {
character_attributes_.SetDefaultLanguage(language);
// Persistent the method.
@ -141,7 +144,10 @@ void SpellCheckClient::requestCheckingOfText(
blink::WebString SpellCheckClient::autoCorrectWord(
const blink::WebString& misspelledWord) {
return GetAutoCorrectionWord(base::string16(misspelledWord));
if (auto_spell_correct_turned_on_)
return GetAutoCorrectionWord(base::string16(misspelledWord));
else
return blink::WebString();
}
void SpellCheckClient::showSpellingUI(bool show) {