| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SPELLCHECKER_PLATFORM_ENGINE_H_ | 8 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PLATFORM_MAC_H_ |
| 9 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_PLATFORM_ENGINE_H_ | 9 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PLATFORM_MAC_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 | 17 |
| 18 class BrowserMessageFilter; | 18 class BrowserMessageFilter; |
| 19 | 19 |
| 20 namespace SpellCheckerPlatform { | 20 namespace spellcheck_mac { |
| 21 | 21 |
| 22 // Get the languages supported by the platform spellchecker and store them in | 22 // Get the languages supported by the platform spellchecker and store them in |
| 23 // |spellcheck_languages|. Note that they must be converted to | 23 // |spellcheck_languages|. Note that they must be converted to |
| 24 // Chromium style codes (en-US not en_US). See spellchecker.cc for a full list. | 24 // Chromium style codes (en-US not en_US). See spellchecker.cc for a full list. |
| 25 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages); | 25 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages); |
| 26 | 26 |
| 27 // Returns true if there is a platform-specific spellchecker that can be used. | 27 // Returns true if there is a platform-specific spellchecker that can be used. |
| 28 bool SpellCheckerAvailable(); | 28 bool SpellCheckerAvailable(); |
| 29 | 29 |
| 30 // Returns true if the platform spellchecker has a spelling panel. | 30 // Returns true if the platform spellchecker has a spelling panel. |
| 31 bool SpellCheckerProvidesPanel(); | 31 bool SpellCheckerProvidesPanel(); |
| 32 | 32 |
| 33 // Returns true if the platform spellchecker panel is visible. | 33 // Returns true if the platform spellchecker panel is visible. |
| 34 bool SpellingPanelVisible(); | 34 bool SpellingPanelVisible(); |
| 35 | 35 |
| 36 // Shows the spelling panel if |show| is true and hides it if it is not. | 36 // Shows the spelling panel if |show| is true and hides it if it is not. |
| 37 void ShowSpellingPanel(bool show); | 37 void ShowSpellingPanel(bool show); |
| 38 | 38 |
| 39 // Changes the word show in the spelling panel to be |word|. Note that the | 39 // Changes the word show in the spelling panel to be |word|. Note that the |
| 40 // spelling panel need not be displayed for this to work. | 40 // spelling panel need not be displayed for this to work. |
| 41 void UpdateSpellingPanelWithMisspelledWord(const string16& word); | 41 void UpdateSpellingPanelWithMisspelledWord(const string16& word); |
| 42 | 42 |
| 43 // Do any initialization needed for spellchecker. | |
| 44 void Init(); | |
| 45 // TODO(pwicks): should we add a companion to this, TearDown or something? | |
| 46 | |
| 47 // Translates the codes used by chrome to the language codes used by os x | 43 // Translates the codes used by chrome to the language codes used by os x |
| 48 // and checks the given language agains the languages that the current system | 44 // and checks the given language agains the languages that the current system |
| 49 // supports. If the platform-specific spellchecker supports the language, | 45 // supports. If the platform-specific spellchecker supports the language, |
| 50 // then returns true, otherwise false. | 46 // then returns true, otherwise false. |
| 51 bool PlatformSupportsLanguage(const std::string& current_language); | 47 bool PlatformSupportsLanguage(const std::string& current_language); |
| 52 | 48 |
| 53 // Sets the language for the platform-specific spellchecker. | 49 // Sets the language for the platform-specific spellchecker. |
| 54 void SetLanguage(const std::string& lang_to_set); | 50 void SetLanguage(const std::string& lang_to_set); |
| 55 | 51 |
| 56 // Checks the spelling of the given string, using the platform-specific | 52 // Checks the spelling of the given string, using the platform-specific |
| (...skipping 29 matching lines...) Expand all Loading... |
| 86 | 82 |
| 87 // Requests an asyncronous spell and grammar checking. | 83 // Requests an asyncronous spell and grammar checking. |
| 88 // The result is returned to an IPC message to |destination| thus it should | 84 // The result is returned to an IPC message to |destination| thus it should |
| 89 // not be null. | 85 // not be null. |
| 90 void RequestTextCheck(int route_id, | 86 void RequestTextCheck(int route_id, |
| 91 int identifier, | 87 int identifier, |
| 92 int document_tag, | 88 int document_tag, |
| 93 const string16& text, | 89 const string16& text, |
| 94 BrowserMessageFilter* destination); | 90 BrowserMessageFilter* destination); |
| 95 | 91 |
| 96 } // namespace SpellCheckerPlatform | 92 } // namespace spellcheck_mac |
| 97 | 93 |
| 98 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_PLATFORM_ENGINE_H_ | 94 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PLATFORM_MAC_H_ |
| OLD | NEW |