Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/renderer/spellchecker/spellcheck.h

Issue 1275813002: Implemented typo recognition in Chrome for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@4_remove_mac_redundancies
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
please use gerrit instead 2015/08/06 16:58:28 Is this a bad merge? I don't think that you should
dylanking 2015/08/07 03:33:54 Agreed, sorry. Fixed.
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 enum ResultFilter { 45 enum ResultFilter {
46 DO_NOT_MODIFY = 1, // Do not modify results. 46 DO_NOT_MODIFY = 1, // Do not modify results.
47 USE_NATIVE_CHECKER, // Use native checker to double-check. 47 USE_NATIVE_CHECKER, // Use native checker to double-check.
48 }; 48 };
49 49
50 SpellCheck(); 50 SpellCheck();
51 ~SpellCheck() override; 51 ~SpellCheck() override;
52 52
53 void AddSpellcheckLanguage(base::File file, const std::string& language); 53 void AddSpellcheckLanguage(base::File file, const std::string& language);
54 54
55 // If there are no dictionary files, then this requests them from the browser 55 // If there is no dictionary file, then this requests one from the browser
56 // and does not block. In this case it returns true. 56 // and does not block. In this case it returns true.
57 // If there are dictionary files, but their Hunspell has not been loaded, then 57 // If there is a dictionary file, but Hunspell has not been loaded, then
58 // this loads their Hunspell. 58 // this loads Hunspell.
59 // If each dictionary file's Hunspell is already loaded, this does nothing. In 59 // If Hunspell is already loaded, this does nothing. In both the latter cases
60 // both the latter cases it returns false, meaning that it is OK to continue 60 // it returns false, meaning that it is OK to continue spellchecking.
61 // spellchecking.
62 bool InitializeIfNeeded(); 61 bool InitializeIfNeeded();
63 62
64 // SpellCheck a word. 63 // SpellCheck a word.
65 // Returns true if spelled correctly, false otherwise. 64 // Returns true if spelled correctly, false otherwise.
66 // If the spellchecker failed to initialize, always returns true. 65 // If the spellchecker failed to initialize, always returns true.
67 // The |tag| parameter should either be a unique identifier for the document 66 // The |tag| parameter should either be a unique identifier for the document
68 // that the word came from (if the current platform requires it), or 0. 67 // that the word came from (if the current platform requires it), or 0.
69 // In addition, finds the suggested words for a given word 68 // In addition, finds the suggested words for a given word
70 // and puts them into |*optional_suggestions|. 69 // and puts them into |*optional_suggestions|.
71 // If the word is spelled correctly, the vector is empty. 70 // If the word is spelled correctly, the vector is empty.
(...skipping 16 matching lines...) Expand all
88 // Find a possible correctly spelled word for a misspelled word. Computes an 87 // Find a possible correctly spelled word for a misspelled word. Computes an
89 // empty string if input misspelled word is too long, there is ambiguity, or 88 // empty string if input misspelled word is too long, there is ambiguity, or
90 // the correct spelling cannot be determined. 89 // the correct spelling cannot be determined.
91 // NOTE: If using the platform spellchecker, this will send a *lot* of sync 90 // NOTE: If using the platform spellchecker, this will send a *lot* of sync
92 // IPCs. We should probably refactor this if we ever plan to take it out from 91 // IPCs. We should probably refactor this if we ever plan to take it out from
93 // behind its command line flag. 92 // behind its command line flag.
94 base::string16 GetAutoCorrectionWord(const base::string16& word, int tag); 93 base::string16 GetAutoCorrectionWord(const base::string16& word, int tag);
95 94
96 // Requests to spellcheck the specified text in the background. This function 95 // Requests to spellcheck the specified text in the background. This function
97 // posts a background task and calls SpellCheckParagraph() in the task. 96 // posts a background task and calls SpellCheckParagraph() in the task.
98 #if !defined (USE_BROWSER_SPELLCHECKER) 97 #if !defined (OS_MACOSX)
99 void RequestTextChecking(const base::string16& text, 98 void RequestTextChecking(const base::string16& text,
100 blink::WebTextCheckingCompletion* completion); 99 blink::WebTextCheckingCompletion* completion);
101 #endif 100 #endif
102 101
103 // Creates a list of WebTextCheckingResult objects (used by WebKit) from a 102 // Creates a list of WebTextCheckingResult objects (used by WebKit) from a
104 // list of SpellCheckResult objects (used by Chrome). This function also 103 // list of SpellCheckResult objects (used by Chrome). This function also
105 // checks misspelled words returned by the Spelling service and changes the 104 // checks misspelled words returned by the Spelling service and changes the
106 // underline colors of contextually-misspelled words. 105 // underline colors of contextually-misspelled words.
107 void CreateTextCheckingResults( 106 void CreateTextCheckingResults(
108 ResultFilter filter, 107 ResultFilter filter,
(...skipping 16 matching lines...) Expand all
125 // Message handlers. 124 // Message handlers.
126 void OnInit(const std::vector<SpellCheckBDictLanguage>& bdict_languages, 125 void OnInit(const std::vector<SpellCheckBDictLanguage>& bdict_languages,
127 const std::set<std::string>& custom_words, 126 const std::set<std::string>& custom_words,
128 bool auto_spell_correct); 127 bool auto_spell_correct);
129 void OnCustomDictionaryChanged(const std::set<std::string>& words_added, 128 void OnCustomDictionaryChanged(const std::set<std::string>& words_added,
130 const std::set<std::string>& words_removed); 129 const std::set<std::string>& words_removed);
131 void OnEnableAutoSpellCorrect(bool enable); 130 void OnEnableAutoSpellCorrect(bool enable);
132 void OnEnableSpellCheck(bool enable); 131 void OnEnableSpellCheck(bool enable);
133 void OnRequestDocumentMarkers(); 132 void OnRequestDocumentMarkers();
134 133
135 #if !defined (USE_BROWSER_SPELLCHECKER) 134 #if !defined (OS_MACOSX)
136 // Posts delayed spellcheck task and clear it if any. 135 // Posts delayed spellcheck task and clear it if any.
137 // Takes ownership of |request|. 136 // Takes ownership of |request|.
138 void PostDelayedSpellCheckTask(SpellcheckRequest* request); 137 void PostDelayedSpellCheckTask(SpellcheckRequest* request);
139 138
140 // Performs spell checking from the request queue. 139 // Performs spell checking from the request queue.
141 void PerformSpellCheck(SpellcheckRequest* request); 140 void PerformSpellCheck(SpellcheckRequest* request);
142 141
143 // The parameters of a pending background-spellchecking request. When WebKit 142 // The parameters of a pending background-spellchecking request. When WebKit
144 // sends a background-spellchecking request before initializing hunspell, 143 // sends a background-spellchecking request before initializing hunspell,
145 // we save its parameters and start spellchecking after we finish initializing 144 // we save its parameters and start spellchecking after we finish initializing
(...skipping 12 matching lines...) Expand all
158 // Remember state for auto spell correct. 157 // Remember state for auto spell correct.
159 bool auto_spell_correct_turned_on_; 158 bool auto_spell_correct_turned_on_;
160 159
161 // Remember state for spellchecking. 160 // Remember state for spellchecking.
162 bool spellcheck_enabled_; 161 bool spellcheck_enabled_;
163 162
164 DISALLOW_COPY_AND_ASSIGN(SpellCheck); 163 DISALLOW_COPY_AND_ASSIGN(SpellCheck);
165 }; 164 };
166 165
167 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_ 166 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_H_
OLDNEW
« chrome/browser/spellchecker/spellcheck_platform_android.cc ('K') | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698