summaryrefslogtreecommitdiffstats
path: root/chrome/browser/spellchecker.cc
diff options
context:
space:
mode:
authorsidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 20:20:58 +0000
committersidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-03 20:20:58 +0000
commit154a4338764560595dd49305a2343985f728c935 (patch)
tree4ba37d24a2f4980c27145af7c46cd5fdcf1f49a9 /chrome/browser/spellchecker.cc
parent7822e018e5ebabeeb3e8ff46aa67a52b1b1c1cf8 (diff)
downloadchromium_src-154a4338764560595dd49305a2343985f728c935.zip
chromium_src-154a4338764560595dd49305a2343985f728c935.tar.gz
chromium_src-154a4338764560595dd49305a2343985f728c935.tar.bz2
UI Support for Auto Spell Correct. Currently, it is still under the command line flag --auto-spell-correct, which means that this UI support will appear only when the command line flag is enabled.BUG=www.crbug.com/13102TEST=enable this feature through the command line flag --auto-spell-correct and then use the Languages Options menu check box to toggle this feature on/off - test by typing "teh" in a text box.
Review URL: http://codereview.chromium.org/119002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker.cc')
-rw-r--r--chrome/browser/spellchecker.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc
index 68643b5..2a8053d 100644
--- a/chrome/browser/spellchecker.cc
+++ b/chrome/browser/spellchecker.cc
@@ -392,6 +392,7 @@ SpellChecker::SpellChecker(const FilePath& dict_dir,
file_loop_(NULL),
url_request_context_(request_context),
dic_is_downloading_(false),
+ auto_spell_correct_turned_on_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(
dic_download_state_changer_factory_(this)) {
// Remember UI loop to later use this as a proxy to get IO loop.
@@ -414,7 +415,7 @@ SpellChecker::SpellChecker(const FilePath& dict_dir,
}
// Use this dictionary language as the default one of the
- // SpecllcheckCharAttribute object.
+ // SpellcheckCharAttribute object.
character_attributes_.SetDefaultLanguage(language);
}
@@ -479,6 +480,9 @@ bool SpellChecker::Initialize() {
void SpellChecker::GetAutoCorrectionWord(const std::wstring& word,
std::wstring* autocorrect_word) {
autocorrect_word->clear();
+ if (!auto_spell_correct_turned_on_)
+ return;
+
int word_length = static_cast<int>(word.size());
if (word_length < 2 || word_length > kMaxAutoCorrectWordSize)
return;
@@ -519,6 +523,10 @@ void SpellChecker::GetAutoCorrectionWord(const std::wstring& word,
}
}
+void SpellChecker::EnableAutoSpellCorrect(bool turn_on) {
+ auto_spell_correct_turned_on_ = turn_on;
+}
+
void SpellChecker::AddCustomWordsToHunspell() {
// Add custom words to Hunspell.
// This should be done in File Loop, but since Hunspell is in this IO Loop,