OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Integration with Android's built-in spellchecker. |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" |
| 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/spellchecker/spellcheck_platform.h" |
| 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/spellcheck_common.h" |
| 16 #include "chrome/common/spellcheck_messages.h" |
| 17 #include "chrome/common/spellcheck_result.h" |
| 18 #include "content/public/browser/browser_message_filter.h" |
| 19 #include "content/public/browser/browser_thread.h" |
| 20 |
| 21 using base::TimeTicks; |
| 22 using content::BrowserMessageFilter; |
| 23 using content::BrowserThread; |
| 24 |
| 25 namespace spellcheck_platform { |
| 26 |
| 27 void GetAvailableLanguages(std::vector<std::string>* spellcheck_languages) { |
| 28 // is this possible in android? |
| 29 } |
| 30 |
| 31 bool SpellCheckerAvailable() { |
| 32 // Check if the user enabled the kEnableSpellChecker flag in chrome://flags |
| 33 // This flag will only be on at this point if the user is on an Android system |
| 34 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 35 switches::kEnableAndroidSpellChecker); |
| 36 } |
| 37 |
| 38 bool SpellCheckerProvidesPanel() { |
| 39 // this method isn't actually ever used apparently |
| 40 return true; |
| 41 } |
| 42 |
| 43 bool SpellingPanelVisible(){ |
| 44 // JNI? |
| 45 return true; |
| 46 } |
| 47 |
| 48 void ShowSpellingPanel(bool show ){ |
| 49 // I think this refers to the suggestions panel as well as other |
| 50 // options that mac provides. |
| 51 // For our purposes, will probably just be a suggestions panel |
| 52 } |
| 53 |
| 54 void UpdateSpellingPanelWithMisspelledWord(const base::string16& word) { |
| 55 // I think this adds the misspelled word to the top of the OSX spelling panel. |
| 56 } |
| 57 |
| 58 bool PlatformSupportsLanguage(const std::string& current_language) { |
| 59 // don't know if this will be relevant to android, but should be pretty |
| 60 // self explanatory. Used in spellcheck_hunspell_dictionary.cc |
| 61 return true; |
| 62 } |
| 63 |
| 64 void SetLanguage(const std::string& lang_to_set) { |
| 65 // Do not set any language right now, since Chrome should honor the |
| 66 // system spellcheck settings. (http://crbug.com/166046) |
| 67 // Fix this once Chrome actually allows setting a spellcheck language |
| 68 // in chrome://settings. |
| 69 } |
| 70 |
| 71 static int last_seen_tag_; |
| 72 |
| 73 bool CheckSpelling(const base::string16& word_to_check, int tag) { |
| 74 // JNI |
| 75 last_seen_tag_ = true; // to pass strict compilation checks |
| 76 return true; |
| 77 } |
| 78 |
| 79 void FillSuggestionList(const base::string16& wrong_word, |
| 80 std::vector<base::string16>* optional_suggestions) { |
| 81 } |
| 82 |
| 83 void AddWord(const base::string16& word) { |
| 84 // JNI add to user's android dictionary |
| 85 } |
| 86 |
| 87 void RemoveWord(const base::string16& word) { |
| 88 // JNI remove from user's android dictionary |
| 89 } |
| 90 |
| 91 int GetDocumentTag() { |
| 92 return 1; |
| 93 } |
| 94 |
| 95 void IgnoreWord(const base::string16& word) { |
| 96 } |
| 97 |
| 98 void CloseDocumentWithTag(int tag) { |
| 99 } |
| 100 |
| 101 void RequestTextCheck(int document_tag, |
| 102 const base::string16& text, |
| 103 TextCheckCompleteCallback callback) { |
| 104 |
| 105 } |
| 106 |
| 107 } // namespace spellcheck_platform |
| 108 |
OLD | NEW |