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_H_ | 5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ |
6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ | 6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // If the word is spelled correctly, the vector is empty. | 59 // If the word is spelled correctly, the vector is empty. |
60 // If optional_suggestions is NULL, suggested words will not be looked up. | 60 // If optional_suggestions is NULL, suggested words will not be looked up. |
61 // Note that Doing suggest lookups can be slow. | 61 // Note that Doing suggest lookups can be slow. |
62 bool SpellCheckWord(const char16* in_word, | 62 bool SpellCheckWord(const char16* in_word, |
63 int in_word_len, | 63 int in_word_len, |
64 int tag, | 64 int tag, |
65 int* misspelling_start, | 65 int* misspelling_start, |
66 int* misspelling_len, | 66 int* misspelling_len, |
67 std::vector<string16>* optional_suggestions); | 67 std::vector<string16>* optional_suggestions); |
68 | 68 |
69 // SpellCheck a paragrpah. | 69 // SpellCheck a paragraph. |
70 // Returns true if |text| is correctly spelled, false otherwise. | 70 // Returns true if |text| is correctly spelled, false otherwise. |
71 // If the spellchecker failed to initialize, always returns true. | 71 // If the spellchecker failed to initialize, always returns true. |
72 bool SpellCheckParagraph( | 72 bool SpellCheckParagraph( |
73 const string16& text, | 73 const string16& text, |
74 WebKit::WebVector<WebKit::WebTextCheckingResult>* results); | 74 WebKit::WebVector<WebKit::WebTextCheckingResult>* results); |
75 | 75 |
76 // Find a possible correctly spelled word for a misspelled word. Computes an | 76 // Find a possible correctly spelled word for a misspelled word. Computes an |
77 // empty string if input misspelled word is too long, there is ambiguity, or | 77 // empty string if input misspelled word is too long, there is ambiguity, or |
78 // the correct spelling cannot be determined. | 78 // the correct spelling cannot be determined. |
79 // NOTE: If using the platform spellchecker, this will send a *lot* of sync | 79 // NOTE: If using the platform spellchecker, this will send a *lot* of sync |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 class SpellcheckRequest; | 111 class SpellcheckRequest; |
112 | 112 |
113 // RenderProcessObserver implementation: | 113 // RenderProcessObserver implementation: |
114 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 114 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
115 | 115 |
116 // Message handlers. | 116 // Message handlers. |
117 void OnInit(IPC::PlatformFileForTransit bdict_file, | 117 void OnInit(IPC::PlatformFileForTransit bdict_file, |
118 const std::vector<std::string>& custom_words, | 118 const std::vector<std::string>& custom_words, |
119 const std::string& language, | 119 const std::string& language, |
120 bool auto_spell_correct); | 120 bool auto_spell_correct); |
121 void OnWordAdded(const std::string& word); | 121 void OnWordsAddedRemoved( |
122 void OnWordRemoved(const std::string& word); | 122 const std::vector<std::string>& words_added, |
| 123 const std::vector<std::string>& words_removed); |
123 void OnEnableAutoSpellCorrect(bool enable); | 124 void OnEnableAutoSpellCorrect(bool enable); |
124 void OnEnableSpellCheck(bool enable); | 125 void OnEnableSpellCheck(bool enable); |
125 | 126 |
126 // If there is no dictionary file, then this requests one from the browser | 127 // If there is no dictionary file, then this requests one from the browser |
127 // and does not block. In this case it returns true. | 128 // and does not block. In this case it returns true. |
128 // If there is a dictionary file, but Hunspell has not been loaded, then | 129 // If there is a dictionary file, but Hunspell has not been loaded, then |
129 // this loads Hunspell. | 130 // this loads Hunspell. |
130 // If Hunspell is already loaded, this does nothing. In both the latter cases | 131 // If Hunspell is already loaded, this does nothing. In both the latter cases |
131 // it returns false, meaning that it is OK to continue spellchecking. | 132 // it returns false, meaning that it is OK to continue spellchecking. |
132 bool InitializeIfNeeded(); | 133 bool InitializeIfNeeded(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // hunspell. (When WebKit sends two or more requests, we cancel the previous | 182 // hunspell. (When WebKit sends two or more requests, we cancel the previous |
182 // requests so we do not have to use vectors.) | 183 // requests so we do not have to use vectors.) |
183 #if !defined (OS_MACOSX) | 184 #if !defined (OS_MACOSX) |
184 scoped_ptr<SpellcheckRequest> pending_request_param_; | 185 scoped_ptr<SpellcheckRequest> pending_request_param_; |
185 #endif | 186 #endif |
186 | 187 |
187 DISALLOW_COPY_AND_ASSIGN(SpellCheck); | 188 DISALLOW_COPY_AND_ASSIGN(SpellCheck); |
188 }; | 189 }; |
189 | 190 |
190 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ | 191 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ |
OLD | NEW |