OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ | 5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ |
6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ | 6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 // In addition, finds the suggested words for a given word | 32 // In addition, finds the suggested words for a given word |
33 // and puts them into |*optional_suggestions|. | 33 // and puts them into |*optional_suggestions|. |
34 // If the word is spelled correctly, the vector is empty. | 34 // If the word is spelled correctly, the vector is empty. |
35 // If optional_suggestions is NULL, suggested words will not be looked up. | 35 // If optional_suggestions is NULL, suggested words will not be looked up. |
36 // Note that doing suggest lookups can be slow. | 36 // Note that doing suggest lookups can be slow. |
37 bool SpellCheckWord(const char16* in_word, | 37 bool SpellCheckWord(const char16* in_word, |
38 int in_word_len, | 38 int in_word_len, |
39 int tag, | 39 int tag, |
40 int* misspelling_start, | 40 int* misspelling_start, |
41 int* misspelling_len, | 41 int* misspelling_len, |
42 std::vector<string16>* optional_suggestions); | 42 std::vector<base::string16>* optional_suggestions); |
43 | 43 |
44 // Initialize |spellcheck_| if that hasn't happened yet. | 44 // Initialize |spellcheck_| if that hasn't happened yet. |
45 bool InitializeIfNeeded(); | 45 bool InitializeIfNeeded(); |
46 | 46 |
47 // Return true if the underlying spellcheck engine is enabled. | 47 // Return true if the underlying spellcheck engine is enabled. |
48 bool IsEnabled(); | 48 bool IsEnabled(); |
49 | 49 |
50 private: | 50 private: |
51 friend class SpellCheckTest; | 51 friend class SpellCheckTest; |
52 | 52 |
53 // Returns whether or not the given word is a contraction of valid words | 53 // Returns whether or not the given word is a contraction of valid words |
54 // (e.g. "word:word"). | 54 // (e.g. "word:word"). |
55 bool IsValidContraction(const string16& word, int tag); | 55 bool IsValidContraction(const base::string16& word, int tag); |
56 | 56 |
57 // Represents character attributes used for filtering out characters which | 57 // Represents character attributes used for filtering out characters which |
58 // are not supported by this SpellCheck object. | 58 // are not supported by this SpellCheck object. |
59 SpellcheckCharAttribute character_attributes_; | 59 SpellcheckCharAttribute character_attributes_; |
60 | 60 |
61 // Represents word iterators used in this spellchecker. The |text_iterator_| | 61 // Represents word iterators used in this spellchecker. The |text_iterator_| |
62 // splits text provided by WebKit into words, contractions, or concatenated | 62 // splits text provided by WebKit into words, contractions, or concatenated |
63 // words. The |contraction_iterator_| splits a concatenated word extracted by | 63 // words. The |contraction_iterator_| splits a concatenated word extracted by |
64 // |text_iterator_| into word components so we can treat a concatenated word | 64 // |text_iterator_| into word components so we can treat a concatenated word |
65 // consisting only of correct words as a correct word. | 65 // consisting only of correct words as a correct word. |
66 SpellcheckWordIterator text_iterator_; | 66 SpellcheckWordIterator text_iterator_; |
67 SpellcheckWordIterator contraction_iterator_; | 67 SpellcheckWordIterator contraction_iterator_; |
68 | 68 |
69 // Pointer to a platform-specific spelling engine, if it is in use. This | 69 // Pointer to a platform-specific spelling engine, if it is in use. This |
70 // should only be set if hunspell is not used. (I.e. on OSX, for now) | 70 // should only be set if hunspell is not used. (I.e. on OSX, for now) |
71 scoped_ptr<SpellingEngine> platform_spelling_engine_; | 71 scoped_ptr<SpellingEngine> platform_spelling_engine_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguage); | 73 DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguage); |
74 }; | 74 }; |
75 | 75 |
76 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ | 76 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_LANGUAGE_H_ |
OLD | NEW |