Chromium Code Reviews| 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 // don't know what this means, method isn't actually used ever apparently | |
| 40 return true; | |
| 41 } | |
| 42 | |
| 43 bool SpellingPanelVisible(){ | |
| 44 // will probably need to implement this using 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 // in any case, will probably be a JNI implementation | |
| 53 } | |
| 54 | |
| 55 void UpdateSpellingPanelWithMisspelledWord(const base::string16& word) { | |
| 56 // I think this adds the misspelled word to the top of the OSX spelling panel. | |
| 57 } | |
| 58 | |
| 59 bool PlatformSupportsLanguage(const std::string& current_language) { | |
| 60 // don't know if this will be relevant to android, but should be pretty | |
| 61 // self explanatory. Used in spellcheck_hunspell_dictionary.cc | |
| 62 return true; | |
| 63 } | |
| 64 | |
| 65 void SetLanguage(const std::string& lang_to_set) { | |
| 66 // Do not set any language right now, since Chrome should honor the | |
| 67 // system spellcheck settings. (http://crbug.com/166046) | |
| 68 // Fix this once Chrome actually allows setting a spellcheck language | |
| 69 // in chrome://settings. | |
| 70 // 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
| |
| 71 // [SharedSpellChecker() setLanguage:NS_lang_to_set]; | |
| 72 } | |
| 73 | |
| 74 static int last_seen_tag_; | |
| 75 | |
| 76 bool CheckSpelling(const base::string16& word_to_check, int tag) { | |
| 77 // JNI | |
| 78 last_seen_tag_ = true; // to pass strict compilation checks | |
| 79 return true; | |
| 80 } | |
| 81 | |
| 82 void FillSuggestionList(const base::string16& wrong_word, | |
| 83 std::vector<base::string16>* optional_suggestions) { | |
| 84 // JNI | |
| 85 } | |
| 86 | |
| 87 void AddWord(const base::string16& word) { | |
| 88 // JNI add to user's android dictionary | |
| 89 } | |
| 90 | |
| 91 void RemoveWord(const base::string16& word) { | |
| 92 // JNI remove from user's android dictionary | |
| 93 } | |
| 94 | |
| 95 int GetDocumentTag() { | |
| 96 // don't really know exactly what this is | |
| 97 return 1; | |
| 98 } | |
| 99 | |
| 100 void IgnoreWord(const base::string16& word) { | |
| 101 // uses last_seen_tag_ from above | |
| 102 } | |
| 103 | |
| 104 void CloseDocumentWithTag(int tag) { | |
| 105 // nor this | |
| 106 } | |
| 107 | |
| 108 void RequestTextCheck(int document_tag, | |
| 109 const base::string16& text, | |
| 110 TextCheckCompleteCallback callback) { | |
| 111 | |
| 112 } | |
| 113 | |
| 114 } // namespace spellcheck_platform | |
| 115 | |
| OLD | NEW |