summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
blob: e113fded051661a4dffb09f95e9f55acb8b2fecf (plain)
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
// Copyright 2014 The Chromium Authors. All rights reserved.
// 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 AutocompleteAdditionalInfo {
  string key;
  string value;
};

struct AutocompleteMatch {
  string? provider_name;
  // Only meaningful if |provider_name| is valid.
  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;
  bool has_tab_match;
  string? associated_keyword;
  string keyword;
  bool starred;
  int32 duplicates;
  bool from_previous;
  array<AutocompleteAdditionalInfo> 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;
};

interface OmniboxPageHandler {
  // Registers the webui page.
  SetClientPage(pending_remote<OmniboxPage> page);
  // Prompts a autocopmlete 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);
};

interface OmniboxPage {
  // Notifies the page of an omnibox response from a autocomplete
  // controller. |is_page_controller| indicates wether the response
  // originates from a query initiated from the page via
  // |StartOmniboxQuery| or from the browser omnibox.
  HandleNewAutocompleteResponse(OmniboxResponse response,
                                bool is_page_controller);
  // Notifies the page a new omnibox query has begun.
  HandleNewAutocompleteQuery(bool is_page_controller, string input_text);
  // Asyncronously notifies the page of the image data URLs for previous omnibox
  // responses.
  HandleAnswerImageData(string image_url, string image_data);
};