| // Copyright 2016 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 chrome.mojom; |
| |
| import "mojo/public/mojom/base/string16.mojom"; |
| import "mojo/public/mojom/base/time.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| [Native] |
| enum NTPLoggingEventType; |
| |
| [Native] |
| enum NTPSuggestionsLoggingEventType; |
| |
| [Native] |
| enum OmniboxFocusState; |
| |
| [Native] |
| struct NTPTileImpression; |
| |
| // Interface used to connect to the embedded search interface. This is a |
| // separate interface such that a reverse connection (|client| below) can be |
| // passed when connecting. |
| interface EmbeddedSearchConnector { |
| // Connect to the interface. |embedded_search| is the connection which the |
| // client will use to query the embedded search interface. |client| is the |
| // connection used by the embedded search interface implementation to push |
| // browser state updates to the client. |
| Connect(pending_associated_receiver<EmbeddedSearch> embedded_search, |
| pending_associated_remote<EmbeddedSearchClient> client); |
| }; |
| |
| // See components/omnibox/browser/autocomplete_match.h. |
| struct ACMatchClassification { |
| uint32 offset; |
| int32 style; |
| }; |
| |
| struct AutocompleteMatch { |
| bool allowed_to_be_default_match; |
| mojo_base.mojom.String16 contents; |
| array<ACMatchClassification> contents_class; |
| mojo_base.mojom.String16 description; |
| array<ACMatchClassification> description_class; |
| string destination_url; |
| mojo_base.mojom.String16 inline_autocompletion; |
| mojo_base.mojom.String16 fill_into_edit; |
| bool is_search_type; // Result of AutocompleteMatch::IsSearchType(). |
| string type; // Result of AutocompleteMatchType::ToString(). |
| bool swap_contents_and_description; |
| bool supports_deletion; |
| }; |
| |
| struct AutocompleteResult { |
| mojo_base.mojom.String16 input; |
| array<AutocompleteMatch> matches; |
| }; |
| |
| // Browser interface to support embedded search. Render frames connect to this |
| // interface to query browser data, such as the most visited pages. |
| // See http://dev.chromium.org/embeddedsearch |
| interface EmbeddedSearch { |
| // Tells InstantExtended to set the omnibox focus state. |
| FocusOmnibox(int32 page_seq_no, bool focus); |
| |
| // Tells InstantExtended to delete a most visited item. |
| DeleteMostVisitedItem(int32 page_seq_no, url.mojom.Url url); |
| |
| // Tells InstantExtended to undo all most visited item deletions. |
| UndoAllMostVisitedDeletions(int32 page_seq_no); |
| |
| // Tells InstantExtended to undo one most visited item deletion. |
| UndoMostVisitedDeletion(int32 page_seq_no, url.mojom.Url url); |
| |
| // Tells InstantExtended to add a custom link. Returns true if successful. |
| AddCustomLink(int32 page_seq_no, url.mojom.Url url, string title) |
| => (bool success); |
| |
| // Tells InstantExtended to update a custom link. Returns true if successful. |
| UpdateCustomLink(int32 page_seq_no, |
| url.mojom.Url url, |
| url.mojom.Url new_url, |
| string new_title) => (bool success); |
| |
| // Tells InstantExtended to reorder a custom link. |
| ReorderCustomLink(int32 page_seq_no, url.mojom.Url url, int32 new_pos); |
| |
| // Tells InstantExtended to delete a custom link. Returns true if successful. |
| DeleteCustomLink(int32 page_seq_no, url.mojom.Url url) => (bool success); |
| |
| // Tells InstantExtended to undo the previous custom link action (add, edit, |
| // delete, etc.). |
| UndoCustomLinkAction(int32 page_seq_no); |
| |
| // Tells InstantExtended to delete all custom links and use most visited sites |
| // instead. |
| ResetCustomLinks(int32 page_seq_no); |
| |
| // Tells InstantExtended to toggle between most visited items or custom links. |
| ToggleMostVisitedOrCustomLinks(int32 page_seq_no); |
| |
| // Tells InstantExtended to toggle visibility of the shortcuts and notify |
| // observers if |do_notify|. |
| ToggleShortcutsVisibility(int32 page_seq_no, bool do_notify); |
| |
| // Logs events from InstantExtended New Tab Pages. |
| LogEvent(int32 page_seq_no, |
| NTPLoggingEventType event, |
| mojo_base.mojom.TimeDelta time); |
| |
| // Logs events related to search suggestions from InstantExtended New Tab |
| // Pages along with an integer value. These events currently include number |
| // of suggestion chips shown and the index of chips that were clicked. |
| LogSuggestionEventWithValue(int32 page_seq_no, |
| NTPSuggestionsLoggingEventType event, |
| int32 data, |
| mojo_base.mojom.TimeDelta time); |
| |
| // Logs an impression on one of the Most Visited tile on the InstantExtended |
| // New Tab Page. |
| LogMostVisitedImpression(int32 page_seq_no, NTPTileImpression impression); |
| |
| // Logs a navigation on one of the Most Visited tile on the InstantExtended |
| // New Tab Page. |
| LogMostVisitedNavigation(int32 page_seq_no, NTPTileImpression impression); |
| |
| // Tells InstantExtended to paste text into the omnibox. If text is empty, |
| // the clipboard contents will be pasted. This causes the omnibox dropdown to |
| // open. |
| PasteAndOpenDropdown(int32 page_seq_no, |
| mojo_base.mojom.String16 text_to_be_pasted); |
| |
| // Updates the NTP custom background preferences. |
| SetCustomBackgroundInfo(url.mojom.Url background_url, |
| string attribution_line_1, |
| string attribution_line_2, |
| url.mojom.Url action_url, |
| string collection_id); |
| |
| // Let the user select a local file for the NTP background. |
| SelectLocalBackgroundImage(); |
| |
| // Add a search suggestion task id to the blocklist. |
| BlocklistSearchSuggestion(int32 task_version, int64 task_id); |
| |
| // Add a search suggestion task id and hash to the blocklist. |
| BlocklistSearchSuggestionWithHash(int32 task_version, int64 task_id, |
| array<uint8, 4> hash); |
| |
| // A search suggestion was selected, issue a new request with the suggestion |
| // temporarily added to the blocklist. |
| SearchSuggestionSelected(int32 task_version, int64 task_id, |
| array<uint8, 4> hash); |
| |
| // Opts the user out of receiving search suggestions. |
| OptOutOfSearchSuggestions(); |
| |
| // Applies the default theme. |
| ApplyDefaultTheme(); |
| |
| // Applies autogenerated theme for the given color. |
| ApplyAutogeneratedTheme(uint32 color); |
| |
| // Reverts applied theme changes. |
| RevertThemeChanges(); |
| |
| // Confirms applied theme changes. |
| ConfirmThemeChanges(); |
| |
| // Queries autocomplete matches from the browser. |
| QueryAutocomplete(mojo_base.mojom.String16 input, |
| bool prevent_inline_autocomplete); |
| |
| // Deletes the AutocompleteMatch in the current results by |line| number if |
| // it is deletable. |
| DeleteAutocompleteMatch(uint8 line); |
| |
| // Cancels the current autocomplete query. Clears the result set if |
| // |clear_result| is true. |
| StopAutocomplete(bool clear_result); |
| |
| // Called when a user dismisses a promo. |
| BlocklistPromo(string promo_id); |
| |
| // Handles navigation to an autocomplete match (i.e. an item in the realbox's |
| // list of matches). Note: |url| is passed solely to verify that the browser |
| // and renderer are in sync; don't trust this content or use it for anything |
| // other than verification purposes (i.e. is the URL still the same?). |
| OpenAutocompleteMatch(uint8 line, |
| url.mojom.Url url, |
| bool are_matches_showing, |
| double time_elapsed_since_last_focus, |
| double button, |
| bool alt_key, |
| bool ctrl_key, |
| bool meta_key, |
| bool shift_key); |
| }; |
| |
| [Native] |
| enum OmniboxFocusChangeReason; |
| |
| [Native] |
| struct InstantMostVisitedInfo; |
| |
| [Native] |
| struct NtpTheme; |
| |
| [Native] |
| struct SearchBoxTheme; |
| |
| // Renderer interface used by the browser to push updates to the client. For |
| // example, the browser will tell the frame if the omnibox got focus. |
| interface EmbeddedSearchClient { |
| // Updates the NTP realbox with the autocomplete results. |
| AutocompleteResultChanged(AutocompleteResult result); |
| |
| // Update the page sequence number for the page. |
| SetPageSequenceNumber(int32 page_seq_no); |
| |
| // Focus on the Omnibox has changed, the fakebox focus state may need to |
| // be updated. |
| FocusChanged(OmniboxFocusState new_focus_state, |
| OmniboxFocusChangeReason reason); |
| |
| // The data for the NTP shortcuts has changed and shortcuts should be |
| // reloaded. |
| MostVisitedInfoChanged(InstantMostVisitedInfo most_visited_info); |
| |
| // Input into the Omnibox has started/stopped. |
| SetInputInProgress(bool input_in_progress); |
| |
| // The NTP theme has changed; update accordingly. |
| ThemeChanged(NtpTheme theme); |
| |
| // A background image was selected from the file upload dialog. |
| LocalBackgroundSelected(); |
| }; |
| |
| // SearchBouncer tracks the NTP URL specified by the default search provider, |
| // which should be transferred back to the browser process for potential |
| // reassignment to an Instant renderer process. |
| interface SearchBouncer { |
| SetNewTabPageURL(url.mojom.Url new_tab_page_url); |
| }; |