diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 20:02:04 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 20:02:04 +0000 |
commit | 63271da3b3740aadd3bd5d186bf7bd2b33ee6347 (patch) | |
tree | 43ab35878220b56a78a8dda05b775df87ddacc4e /chrome/browser/spellchecker.h | |
parent | 64b421f984b2dfe04546729f8b35648cac3d0f20 (diff) | |
download | chromium_src-63271da3b3740aadd3bd5d186bf7bd2b33ee6347.zip chromium_src-63271da3b3740aadd3bd5d186bf7bd2b33ee6347.tar.gz chromium_src-63271da3b3740aadd3bd5d186bf7bd2b33ee6347.tar.bz2 |
Add support for "Add to dictionary" in the context menu.
Review URL: http://codereview.chromium.org/2446
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker.h')
-rw-r--r-- | chrome/browser/spellchecker.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/spellchecker.h b/chrome/browser/spellchecker.h index da17ee5..932d3c9 100644 --- a/chrome/browser/spellchecker.h +++ b/chrome/browser/spellchecker.h @@ -35,9 +35,13 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { // // The request context is used to download dictionaries if they do not exist. // This can be NULL if you don't want this (like in tests). + // The |custom_dictionary_file_name| should be left blank so that Spellchecker + // can figure out the custom dictionary file. It is non empty only for unit + // testing. SpellChecker(const std::wstring& dict_dir, const std::wstring& language, - URLRequestContext* request_context); + URLRequestContext* request_context, + const std::wstring& custom_dictionary_file_name); static void RegisterUserPrefs(PrefService* prefs); @@ -58,6 +62,11 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { int* misspelling_len, std::vector<std::wstring>* optional_suggestions); + // Add custom word to the dictionary, which means: + // a) Add it to the current hunspell object for immediate use, + // b) Add the word to a file in disk for custom dictionary. + void AddWord(const std::wstring& word); + private: // Download dictionary files when required. class DictionaryDownloadController; @@ -67,6 +76,10 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { // Initializes the Hunspell Dictionary. bool Initialize(); + // After |hunspell_| is initialized, this function is called to add custom + // words from the custom dictionary to the |hunspell_| + void AddCustomWordsToHunspell(); + void set_file_is_downloading(bool value); // Memory maps the given .bdic file. On success, it will return true and will @@ -80,6 +93,9 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { // Path to the spellchecker file. std::wstring bdict_file_name_; + // Path to the custom dictionary file. + std::wstring custom_dictionary_file_name_; + // We memory-map the BDict file for spellchecking. These are the handles // necessary for that. HANDLE bdict_file_; |