File: spellcheck.mojom

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (94 lines) | stat: -rw-r--r-- 3,450 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module spellcheck.mojom;

import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/string16.mojom";

// Render process interface exposed to the browser for receiving process-
// wide spellcheck control and updates from the browser process.
//
interface SpellChecker {
  // Initialize the render process spellchecker. Called after startup and
  // also in response to a renderer's spellcheck.mojom.SpellCheckHost
  // RequestDictionary request.
  Initialize(array<SpellCheckBDictLanguage> dictionaries,
             array<string> custom_words,
             bool enable);

  // Custom dictionary words have been added or removed: update the local
  // custom word list.
  CustomDictionaryChanged(
      array<string> words_added, array<string> words_removed);
};

struct SpellCheckBDictLanguage {
  mojo_base.mojom.ReadOnlyFile? file;
  string language;
};

// Browser process interface exposed to the renderer for requesting spell-
// check host services to be initialized.
//
interface SpellCheckInitializationHost {
  // Asks the browser to initialize the renderer's spellcheck system. The
  // initialize call arrives on interface spellcheck.mojom.SpellChecker
  // in async response to this request.
  RequestDictionary();
};

// Browser process interface exposed to the renderer for requesting spell-
// check host services. This interface is bound per frame.
//
interface SpellCheckHost {
  // Tracks spell checking occurrences to collect histograms, where |word|
  // was checked, and |misspelled| is true if |word| was misspelt.
  NotifyChecked(mojo_base.mojom.String16 word, bool misspelled);

  // Asks the host to spellcheck the |text| using a remote Spelling server
  // to do the spellchecking. If the remote Spelling server is available,
  // returns |success| true, and the spellchecked |results|.
  [EnableIf=USE_RENDERER_SPELLCHECKER]
  CallSpellingService(mojo_base.mojom.String16 text)
      => (bool success, array<SpellCheckResult> results);

  // Asks the host to spellcheck the |text| using a platform-specific spell
  // checker, and returns the spellchecked |results|.
  [EnableIf=USE_BROWSER_SPELLCHECKER]
  RequestTextCheck(mojo_base.mojom.String16 text)
      => (array<SpellCheckResult> results);

  // Disconnects the Android spell checker session bridge.
  [EnableIf=is_android]
  DisconnectSessionBridge();

  // Checks the correctness of a word with a platform-specific spell checker.
  [EnableIf=USE_BROWSER_SPELLCHECKER_AND_SPELLING_SERVICE, Sync]
  CheckSpelling(mojo_base.mojom.String16 word) => (bool correct);

  // Returns a list of suggestions for a given word with a platform-specific
  // spell checker.
  [EnableIf=USE_BROWSER_SPELLCHECKER_AND_SPELLING_SERVICE, Sync]
  FillSuggestionList(mojo_base.mojom.String16 word)
      => (array<mojo_base.mojom.String16> suggestions);

  // Completes initialization of the spellcheck service by loading dictionaries.
  [EnableIf=is_win]
  InitializeDictionaries() => (array<SpellCheckBDictLanguage> dictionaries,
                               array<string> custom_words,
                               bool enable);
};

enum Decoration {
  kSpelling,
  kGrammar,
};

struct SpellCheckResult {
  Decoration decoration;
  int32 location;
  int32 length;
  array<mojo_base.mojom.String16> replacements;
};