| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module spellcheck.mojom; | 5 module spellcheck.mojom; |
| 6 | 6 |
| 7 import "mojo/common/file.mojom"; | 7 import "mojo/common/file.mojom"; |
| 8 import "mojo/common/string16.mojom"; |
| 8 | 9 |
| 9 // Render process interface exposed to the browser for receiving process- | 10 // Render process interface exposed to the browser for receiving process- |
| 10 // wide spellcheck control and updates from the browser process. | 11 // wide spellcheck control and updates from the browser process. |
| 11 // | 12 // |
| 12 interface SpellChecker { | 13 interface SpellChecker { |
| 13 // Initialize the render process spellchecker. Called after startup and | 14 // Initialize the render process spellchecker. Called after startup and |
| 14 // also in response to a render process RequestDictionary request. | 15 // also in response to a render process RequestDictionary request. |
| 15 Initialize(array<SpellCheckBDictLanguage> dictionaries, | 16 Initialize(array<SpellCheckBDictLanguage> dictionaries, |
| 16 array<string> custom_words, | 17 array<string> custom_words, |
| 17 bool enable); | 18 bool enable); |
| 18 | 19 |
| 19 // Custom dictionary words have been added or removed: update the local | 20 // Custom dictionary words have been added or removed: update the local |
| 20 // custom word list. | 21 // custom word list. |
| 21 CustomDictionaryChanged(array<string> words_added, | 22 CustomDictionaryChanged(array<string> words_added, |
| 22 array<string> words_removed); | 23 array<string> words_removed); |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 struct SpellCheckBDictLanguage { | 26 struct SpellCheckBDictLanguage { |
| 26 mojo.common.mojom.File? file; | 27 mojo.common.mojom.File? file; |
| 27 string language; | 28 string language; |
| 28 }; | 29 }; |
| 30 |
| 31 // Browser process interface exposed to the renderer for requesting spell- |
| 32 // check host services. |
| 33 // |
| 34 interface SpellCheckHost { |
| 35 // Asks the browser to initialize the renderer's spellchecker: the spell |
| 36 // checker initialize call arrives on spellcheck::mojom::SpellChecker in |
| 37 // async response to this request. |
| 38 RequestDictionary(); |
| 39 |
| 40 // Tracks spell checking occurrences to collect histograms, where |word| |
| 41 // was checked, and |misspelled| is true if |word| was misspelt. |
| 42 NotifyChecked(mojo.common.mojom.String16 word, bool misspelled); |
| 43 |
| 44 // Asks the host to spellcheck the |text| using a remote Spelling server |
| 45 // to do the spellchecking. If the remote Spelling server is available, |
| 46 // returns |success| true, and the spellchecked |results|. Note this API |
| 47 // requires a !BUILDFLAG(USE_BROWSER_SPELLCHECKER) build. |
| 48 CallSpellingService(mojo.common.mojom.String16 text) => |
| 49 (bool success, array<SpellCheckResult> results); |
| 50 }; |
| 51 |
| 52 [Native] |
| 53 struct SpellCheckResult; |
| OLD | NEW |