OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file defines the interface that any platform-specific spellchecker | 5 // This file defines the interface that any platform-specific spellchecker |
6 // needs to implement in order to be used by the browser. | 6 // needs to implement in order to be used by the browser. |
7 | 7 |
8 #ifndef CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ | 8 #ifndef CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ |
9 #define CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ | 9 #define CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "chrome/browser/spellchecker_common.h" | 14 #include "chrome/browser/spellchecker_common.h" |
15 | 15 |
16 namespace SpellCheckerPlatform { | 16 namespace SpellCheckerPlatform { |
17 // Returns true if there is an platform-specific spellchecker. | 17 // Returns true if there is an platform-specific spellchecker. |
18 bool SpellCheckerAvailable(); | 18 bool SpellCheckerAvailable(); |
19 // Do any initialization needed for spellchecker. | 19 // Do any initialization needed for spellchecker. |
20 void Init(); | 20 void Init(); |
21 // TODO(pwicks): should we add a companion to this, TearDown or something? | 21 // TODO(pwicks): should we add a companion to this, TearDown or something? |
22 | 22 |
23 // Translates the codes used by chrome to the language codes used by os x | 23 // Translates the codes used by chrome to the language codes used by os x |
24 // and checks the given language agains the languages that the current system | 24 // and checks the given language agains the languages that the current system |
25 // supports. If the platform-specific spellchecker supports the language, | 25 // supports. If the platform-specific spellchecker supports the language, |
26 // then returns true, otherwise false. | 26 // then returns true, otherwise false. |
27 bool PlatformSupportsLanguage(const Language& current_language); | 27 bool PlatformSupportsLanguage(const std::string& current_language); |
28 // Sets the language for the platform-specific spellchecker. | 28 // Sets the language for the platform-specific spellchecker. |
29 void SetLanguage(const Language& lang_to_set); | 29 void SetLanguage(const std::string& lang_to_set); |
30 // Checks the spelling of the given string, using the platform-specific | 30 // Checks the spelling of the given string, using the platform-specific |
31 // spellchecker. Returns true if the word is spelled correctly. | 31 // spellchecker. Returns true if the word is spelled correctly. |
32 bool CheckSpelling(const std::string& word_to_check); | 32 bool CheckSpelling(const std::string& word_to_check); |
33 // Fills the given vector |optional_suggestions| with a number (up to | 33 // Fills the given vector |optional_suggestions| with a number (up to |
34 // kMaxSuggestions, which is defined in spellchecker_common.h) of suggestions | 34 // kMaxSuggestions, which is defined in spellchecker_common.h) of suggestions |
35 // for the string |wrong_word|. | 35 // for the string |wrong_word|. |
36 void FillSuggestionList(const std::string& wrong_word, | 36 void FillSuggestionList(const std::string& wrong_word, |
37 std::vector<std::wstring>* optional_suggestions); | 37 std::vector<std::wstring>* optional_suggestions); |
38 // Adds the given word to the platform dictionary. | 38 // Adds the given word to the platform dictionary. |
39 void AddWord(const std::wstring& word); | 39 void AddWord(const std::wstring& word); |
40 // Remove a given word from the platform dictionary. | 40 // Remove a given word from the platform dictionary. |
41 void RemoveWord(const std::wstring& word); | 41 void RemoveWord(const std::wstring& word); |
42 } | 42 } |
43 | 43 |
44 #endif // CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ | 44 #endif // CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_ |
OLD | NEW |