summaryrefslogtreecommitdiffstats
path: root/chrome/browser/spellchecker_platform_engine.h
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 15:09:05 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 15:09:05 +0000
commit9b75b5b69a63c9a7167badc5ca33e9910d4e390a (patch)
treef4336ee158e22d709c07ba92d0e10f2ae6922836 /chrome/browser/spellchecker_platform_engine.h
parentde9904623b5b91688a98ee987ee6ccfe2f584085 (diff)
downloadchromium_src-9b75b5b69a63c9a7167badc5ca33e9910d4e390a.zip
chromium_src-9b75b5b69a63c9a7167badc5ca33e9910d4e390a.tar.gz
chromium_src-9b75b5b69a63c9a7167badc5ca33e9910d4e390a.tar.bz2
Enable support for the Mac OS X spellchecking service in chromium.
spellchecker_platform_engine.h provides a basic interface for platform specific spellcheckers to follow. spellchecker_mac.mm implements these functions for the OS X spellchecking service. spellchecker_win.cc and spellchecker_linux.cc provide a space for future developments on these platforms. spellchecker_common.h contains a few shared variables and typedefs that are useful across all spellchecking code. spellchecker.cc has been modified to call the SpellCheckerPlatform::SpellCheckerAvailable() and use either hunspell or the platform spellchecker based on that call. Many new test cases have been added to one of the unit tests as well. chrome.gyp has been edited to reflect the added files. patch from pwicks86@gmail.com (paul wicks) BUG=13206 TEST=spellchecking works in web pages git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellchecker_platform_engine.h')
-rw-r--r--chrome/browser/spellchecker_platform_engine.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/spellchecker_platform_engine.h b/chrome/browser/spellchecker_platform_engine.h
new file mode 100644
index 0000000..74a409a
--- /dev/null
+++ b/chrome/browser/spellchecker_platform_engine.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file defines the interface that any platform-specific spellchecker
+// needs to implement in order to be used by the browser.
+
+#ifndef CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_
+#define CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_
+
+#include <string>
+#include <vector>
+
+#include "chrome/browser/spellchecker_common.h"
+
+namespace SpellCheckerPlatform {
+// Returns true if there is an platform-specific spellchecker.
+bool SpellCheckerAvailable();
+// Do any initialization needed for spellchecker.
+void Init();
+// TODO(pwicks): should we add a companion to this, TearDown or something?
+
+// Translates the codes used by chrome to the language codes used by os x
+// and checks the given language agains the languages that the current system
+// supports. If the platform-specific spellchecker supports the language,
+// then returns true, otherwise false.
+bool PlatformSupportsLanguage(const Language& current_language);
+// Sets the language for the platform-specific spellchecker.
+void SetLanguage(const Language& lang_to_set);
+// Checks the spelling of the given string, using the platform-specific
+// spellchecker. Returns true if the word is spelled correctly.
+bool CheckSpelling(const std::string& word_to_check);
+// Fills the given vector |optional_suggestions| with a number (up to
+// kMaxSuggestions, which is defined in spellchecker_common.h) of suggestions
+// for the string |wrong_word|.
+void FillSuggestionList(const std::string& wrong_word,
+ std::vector<std::wstring>* optional_suggestions);
+// Adds the given word to the platform dictionary.
+void AddWord(const std::wstring& word);
+// Remove a given word from the platform dictionary.
+void RemoveWord(const std::wstring& word);
+}
+
+#endif // CHROME_BROWSER_SPELLCHECKER_PLATFORM_ENGINE_H_