File: omnibox.mojom

package info (click to toggle)
chromium 120.0.6099.224-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,112,112 kB
  • sloc: cpp: 32,907,025; ansic: 8,148,123; javascript: 3,679,536; python: 2,031,248; asm: 959,718; java: 804,675; xml: 617,256; sh: 111,417; objc: 100,835; perl: 88,443; cs: 53,032; makefile: 29,579; fortran: 24,137; php: 21,162; tcl: 21,147; sql: 20,809; ruby: 17,735; pascal: 12,864; yacc: 8,045; lisp: 3,388; lex: 1,323; ada: 727; awk: 329; jsp: 267; csh: 117; exp: 43; sed: 37
file content (165 lines) | stat: -rw-r--r-- 5,409 bytes parent folder | download | duplicates (2)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module mojom;

// The structures here roughly mirror those from autocomplete.

struct ACMatchClassification {
  int32 offset;
  int32 style;
};

struct DictionaryEntry {
  string key;
  string value;
};

// Keep consistent:
// - omnibox_event.proto `ScoringSignals`
// - autocomplete_scoring_model_handler.cc
//   `AutocompleteScoringModelHandler::ExtractInputFromScoringSignals()`
// - autocomplete_match.cc `AutocompleteMatch::MergeScoringSignals()`
// - omnibox.mojom `struct Signals`
// - omnibox_page_handler.cc `TypeConverter<AutocompleteMatch::ScoringSignals,
//   mojom::SignalsPtr>`
// - omnibox_page_handler.cc `TypeConverter<mojom::SignalsPtr,
//   AutocompleteMatch::ScoringSignals>`
// - omnibox_util.ts `signalNames`
struct Signals {
  int32? typed_count;
  int32? visit_count;
  int64? elapsed_time_last_visit_secs;
  int32? shortcut_visit_count;
  int32? shortest_shortcut_len;
  int64? elapsed_time_last_shortcut_visit_sec;
  bool? is_host_only;
  int32? num_bookmarks_of_url;
  int32? first_bookmark_title_match_position;
  int32? total_bookmark_title_match_length;
  int32? num_input_terms_matched_by_bookmark_title;
  int32? first_url_match_position;
  int32? total_url_match_length;
  bool? host_match_at_word_boundary;
  int32? total_host_match_length;
  int32? total_path_match_length;
  int32? total_query_or_ref_match_length;
  int32? total_title_match_length;
  bool? has_non_scheme_www_match;
  int32? num_input_terms_matched_by_title;
  int32? num_input_terms_matched_by_url;
  int32? length_of_url;
  float? site_engagement;
  bool? allowed_to_be_default_match;
};

struct AutocompleteMatch {
  string provider_name;
  bool provider_done;
  int32 relevance;
  bool deletable;
  string fill_into_edit;
  string inline_autocompletion;
  string destination_url;
  string stripped_destination_url;
  string image;
  string contents;
  array<ACMatchClassification> contents_class;
  string description;
  array<ACMatchClassification> description_class;
  bool swap_contents_and_description;
  string answer;
  string transition;
  bool allowed_to_be_default_match;
  string type;
  bool is_search_type;
  string aqs_type_subtypes;
  bool has_tab_match;
  string associated_keyword;
  string keyword;
  bool starred;
  int32 duplicates;
  bool from_previous;
  int32 pedal_id;
  Signals scoring_signals;
  array<DictionaryEntry> additional_info;
};

struct AutocompleteResultsForProvider {
  string provider_name;
  array<AutocompleteMatch> results;
};

struct OmniboxResponse {
  int32 cursor_position;
  // Time delta since the request was started, in milliseconds.
  int32 time_since_omnibox_started_ms;
  bool done;
  // The inferred metrics::OmniboxInputType of the request represented as a
  // string.
  string type;
  string host;
  bool is_typed_host;
  string input_text;
  array<AutocompleteMatch> combined_results;
  array<AutocompleteResultsForProvider> results_by_provider;
};

enum AutocompleteControllerType {
  // The autocomplete controller for the real omnibox in the location bar.
  kBrowser = 0,
  // The autocomplete controller used by chrome://omnibox to support customized
  // inputs without messing with the location bar omnibox.
  kDebug = 1,
  // The autocomplete controller used by chrome://omnibox/ml that forces off ML
  // scoring.
  kMlDisabledDebug = 2,
};

// ts (`BrowserProxy`) -> cpp (`OmniboxPageHandler`) path.
interface OmniboxPageHandler {
  // Registers the webui page.
  SetClientPage(pending_remote<OmniboxPage> page);
  // Prompts an autocomplete controller to process an omnibox query.
  StartOmniboxQuery(string input_string,
                    bool reset_autocomplete_controller,
                    int32 cursor_position,
                    bool zero_suggest,
                    bool prevent_inline_autocomplete,
                    bool prefer_keyword,
                    string current_url,
                    int32 page_classification);
  // Gets the ML model version.
  GetMlModelVersion() => (int32 version);
  // Runs `AutocompleteScoringModelService`.
  StartMl(Signals signals) => (float score);
};

// cpp (`OmniboxPageHandler`) -> ts (`BrowserProxy`) path.
interface OmniboxPage {
  // Notifies the page a new omnibox query has begun.
  HandleNewAutocompleteQuery(
    AutocompleteControllerType autocomplete_controller_type,
    string input_text);

  // Notifies the page of an omnibox response from a autocomplete
  // controller.
  HandleNewAutocompleteResponse(
    AutocompleteControllerType autocomplete_controller_type,
    OmniboxResponse response);

  // Notifies the page of an ML scoring batch completing. This is an
  // intermediate step of autocompletion. This occurs before the omnibox
  // response is created (i.e. before `HandleNewAutocompleteResponse()` is
  // called) and won't usually have the same matches.
  HandleNewMlResponse(AutocompleteControllerType autocomplete_controller_type,
                      string input_text,
                      array<AutocompleteMatch> matches);

  // Asynchronously notifies the page of the image data URLs for previous
  // omnibox responses.
  HandleAnswerImageData(AutocompleteControllerType autocomplete_controller_type,
                        string image_url,
                        string image_data);
};