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..51139e7a1f3f7b8e28f457b6e5a58843b8f11c4f |
--- /dev/null |
+++ b/chrome/browser/spellchecker/spellcheck_platform_android.cc |
@@ -0,0 +1,108 @@ |
+// 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() { |
+// this method isn't actually ever used apparently |
+ return true; |
+} |
+ |
+bool SpellingPanelVisible(){ |
+// 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 |
+} |
+ |
+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. |
+} |
+ |
+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) { |
+} |
+ |
+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() { |
+ return 1; |
+} |
+ |
+void IgnoreWord(const base::string16& word) { |
+} |
+ |
+void CloseDocumentWithTag(int tag) { |
+} |
+ |
+void RequestTextCheck(int document_tag, |
+ const base::string16& text, |
+ TextCheckCompleteCallback callback) { |
+ |
+} |
+ |
+} // namespace spellcheck_platform |
+ |