Index: chrome/browser/spellchecker/spellcheck_platform_android.cc |
diff --git a/chrome/browser/spellchecker/spellcheck_platform_android.cc b/chrome/browser/spellchecker/spellcheck_platform_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..511648b511d2c54e6706a7e06175447360595a26 |
--- /dev/null |
+++ b/chrome/browser/spellchecker/spellcheck_platform_android.cc |
@@ -0,0 +1,115 @@ |
+// Copyright 2015 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. |
+ |
+// Integration with Android's built-in spellchecker. |
+ |
+#include "base/bind.h" |
+#include "base/bind_helpers.h" |
+#include "base/command_line.h" |
+#include "base/logging.h" |
+#include "base/strings/sys_string_conversions.h" |
+#include "base/time/time.h" |
+#include "chrome/browser/spellchecker/spellcheck_platform.h" |
+#include "chrome/common/chrome_switches.h" |
+#include "chrome/common/spellcheck_common.h" |
+#include "chrome/common/spellcheck_messages.h" |
+#include "chrome/common/spellcheck_result.h" |
+#include "content/public/browser/browser_message_filter.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+using base::TimeTicks; |
+using content::BrowserMessageFilter; |
+using content::BrowserThread; |
+ |
+namespace spellcheck_platform { |
+ |
+void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { |
+ // is this possible in android? |
+} |
+ |
+bool SpellCheckerAvailable() { |
+ // Check if the user enabled the kEnableSpellChecker flag in chrome://flags |
+ // This flag will only be on at this point if the user is on an Android system |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableAndroidSpellChecker); |
+} |
+ |
+bool SpellCheckerProvidesPanel() { |
+ // don't know what this means, method isn't actually used ever apparently |
+ return true; |
+} |
+ |
+bool SpellingPanelVisible(){ |
+ // will probably need to implement this using JNI |
+ return true; |
+} |
+ |
+void ShowSpellingPanel(bool show ){ |
+ // I think this refers to the suggestions panel as well as other |
+ // options that mac provides. |
+ // For our purposes, will probably just be a suggestions panel |
+ // in any case, will probably be a JNI implementation |
+} |
+ |
+void UpdateSpellingPanelWithMisspelledWord(const base::string16& word) { |
+ // I think this adds the misspelled word to the top of the OSX spelling panel. |
+} |
+ |
+bool PlatformSupportsLanguage(const std::string& current_language) { |
+ // don't know if this will be relevant to android, but should be pretty |
+ // self explanatory. Used in spellcheck_hunspell_dictionary.cc |
+ return true; |
+} |
+ |
+void SetLanguage(const std::string& lang_to_set) { |
+ // Do not set any language right now, since Chrome should honor the |
+ // system spellcheck settings. (http://crbug.com/166046) |
+ // Fix this once Chrome actually allows setting a spellcheck language |
+ // in chrome://settings. |
+ // NSString* NS_lang_to_set = ConvertLanguageCodeToMac(lang_to_set); |
aurimas (slooooooooow)
2015/07/09 18:12:52
Remove the code that does nothing.
dylanking
2015/07/09 18:58:15
Done, along with a bit more comment cleanup in the
|
+ // [SharedSpellChecker() setLanguage:NS_lang_to_set]; |
+} |
+ |
+static int last_seen_tag_; |
+ |
+bool CheckSpelling(const base::string16& word_to_check, int tag) { |
+ // JNI |
+ last_seen_tag_ = true; // to pass strict compilation checks |
+ return true; |
+} |
+ |
+void FillSuggestionList(const base::string16& wrong_word, |
+ std::vector<base::string16>* optional_suggestions) { |
+// JNI |
+} |
+ |
+void AddWord(const base::string16& word) { |
+// JNI add to user's android dictionary |
+} |
+ |
+void RemoveWord(const base::string16& word) { |
+// JNI remove from user's android dictionary |
+} |
+ |
+int GetDocumentTag() { |
+// don't really know exactly what this is |
+ return 1; |
+} |
+ |
+void IgnoreWord(const base::string16& word) { |
+// uses last_seen_tag_ from above |
+} |
+ |
+void CloseDocumentWithTag(int tag) { |
+ // nor this |
+} |
+ |
+void RequestTextCheck(int document_tag, |
+ const base::string16& text, |
+ TextCheckCompleteCallback callback) { |
+ |
+} |
+ |
+} // namespace spellcheck_platform |
+ |