| // 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 AutocompleteAdditionalInfo { |
| string key; |
| string value; |
| }; |
| |
| 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; |
| 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 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); |
| }; |
| |
| interface OmniboxPage { |
| // Notifies the page of an omnibox response from a autocomplete |
| // controller. |is_page_controller| indicates whether 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); |
| // Asynchronously notifies the page of the image data URLs for previous |
| // omnibox responses. |
| HandleAnswerImageData(string image_url, string image_data); |
| }; |