diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 19:20:26 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-11 19:20:26 +0000 |
commit | 1ffed9387c38f75fe7ff13ec54a3cf893005b103 (patch) | |
tree | f87bf6b3ff3fb5b746b380b3cf209df2790c1971 /chrome/browser/spellchecker.h | |
parent | 1d0d8f176df9f7a9043a825541d016189754a27e (diff) | |
download | chromium_src-1ffed9387c38f75fe7ff13ec54a3cf893005b103.zip chromium_src-1ffed9387c38f75fe7ff13ec54a3cf893005b103.tar.gz chromium_src-1ffed9387c38f75fe7ff13ec54a3cf893005b103.tar.bz2 |
Try and make some spellcheck code more obvious by using typedefs.
I am not convinced this patch is a net win. Please share your thoughts on if using a Language/Languages set of types is better or worse than what we're doing now.
Review URL: http://codereview.chromium.org/13367
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker.h')
-rw-r--r-- | chrome/browser/spellchecker.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/chrome/browser/spellchecker.h b/chrome/browser/spellchecker.h index 1283712..45eb73d 100644 --- a/chrome/browser/spellchecker.h +++ b/chrome/browser/spellchecker.h @@ -37,6 +37,9 @@ class URLRequestContext; // deleted on the I/O thread itself. class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { public: + typedef std::wstring Language; + typedef std::vector<Language> Languages; + // Creates the spellchecker by reading dictionaries from the given directory, // and defaulting to the given language. Both strings must be provided. // @@ -46,7 +49,7 @@ class SpellChecker : public base::RefCountedThreadSafe<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, + const Language& language, URLRequestContext* request_context, const std::wstring& custom_dictionary_file_name); @@ -73,14 +76,14 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { void AddWord(const std::wstring& word); // Get SpellChecker supported languages. - static void SpellCheckLanguages(std::vector<std::wstring>* languages); + static void SpellCheckLanguages(Languages* languages); // This function computes a vector of strings which are to be displayed in // the context menu over a text area for changing spell check languages. It // returns the index of the current spell check language in the vector. static int GetSpellCheckLanguagesToDisplayInContextMenu( Profile* profile, - std::vector<std::wstring>* display_language_list); + Languages* display_languages); private: // Download dictionary files when required. @@ -101,15 +104,14 @@ class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { // Returns whether or not the given word is a contraction of valid words // (e.g. "word:word"). - bool IsValidContraction(const std::wstring& word); + bool IsValidContraction(const Language& word); // Return the file name of the dictionary, including the path and the version // numbers. - std::wstring GetVersionedFileName(const std::wstring& language, + std::wstring GetVersionedFileName(const Language& language, const std::wstring& dict_dir); - static std::wstring GetCorrespondingSpellCheckLanguage( - const std::wstring& language); + static Language GetCorrespondingSpellCheckLanguage(const Language& language); // Path to the spellchecker file. std::wstring bdict_file_name_; |