launcher_search.mojom 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module crosapi.mojom;
  5. import "mojo/public/mojom/base/string16.mojom";
  6. import "ui/gfx/image/mojom/image.mojom";
  7. import "url/mojom/url.mojom";
  8. [Stable, Extensible]
  9. enum SearchStatus {
  10. // Indicates an error with the search. No results will be sent with this
  11. // status, and there may or may not be further results sent.
  12. [Default] kError = 0,
  13. // Search session is complete and no more results will be sent. This
  14. // accompanies the final set of results.
  15. kDone = 1,
  16. // Search session is still in progress and further results may be sent. This
  17. // accompanies a set of results.
  18. kInProgress = 2,
  19. // Search session has been cancelled due to a newer query. No more results
  20. // will be sent.
  21. kCancelled = 3,
  22. // The AutocompleteController is unavailable. No more results will be sent.
  23. [MinVersion=1] kBackendUnavailable = 4,
  24. };
  25. // Enum represents the result type.
  26. [Stable, Extensible]
  27. enum SearchResultType {
  28. [Default] kUnknown = 0,
  29. // This represents the results come from Omnibox's AutocompleteController
  30. // of the browser.
  31. kOmniboxResult = 1,
  32. };
  33. // Struct represents search result.
  34. // Next min ID: 22
  35. // Next min version: 6
  36. [Stable]
  37. struct SearchResult {
  38. // Type of the result. Used to distinguish between different types of result.
  39. SearchResultType type@0;
  40. // Relevance of the result. Used for scoring/ranking.
  41. double relevance@1;
  42. // Destination URL of the result. Used for opening the result.
  43. url.mojom.Url? destination_url@2;
  44. // Stripped destination URL of the result. This is computed from
  45. // |destination_url| by performing processing such as stripping off "www.",
  46. // converting https protocol to http, and stripping excess query parameters.
  47. // The stripped URL is used for unique identification and not as an actual
  48. // URL.
  49. [MinVersion=2] url.mojom.Url? stripped_destination_url@14;
  50. // The following fields represent additional information about search
  51. // results. These are optional and will be filled depending on the result.
  52. // Whether the result is an omnibox search result or not. Used for
  53. // kOmniboxResult type results.
  54. OptionalBool is_omnibox_search@3;
  55. // Whether the result is an answer result or not. Used for kOmniboxResult
  56. // type results.
  57. OptionalBool is_answer@4;
  58. // The Omnibox search result type as required for metrics logging. Used for
  59. // kOmniboxResult type results. This defaults to kUnset.
  60. [MinVersion=5] MetricsType metrics_type@20;
  61. // The Omnibox subtype of the result, used for kOmniboxResult type results.
  62. // This defaults to kUnset.
  63. OmniboxType omnibox_type@5;
  64. // The Omnibox answer subtype of the result, used for Omnibox answer results.
  65. // This defaults to kUnset.
  66. AnswerType answer_type@6;
  67. // The page transition type of this result. Used for opening a result.
  68. [MinVersion=2] PageTransition page_transition@15;
  69. // The image url of the result, if any. Used to download the result image. The
  70. // presence of this field defines a result as a "rich entity". We consider
  71. // weather answer results with icons as a special kind of rich entity.
  72. url.mojom.Url? image_url@7;
  73. // Favicon of the result, if available. The presence or absence of this field
  74. // is what defines a result as a "favicon-type result".
  75. gfx.mojom.ImageSkia? favicon@8;
  76. // Handle through which to receive asynchronously-fetched data about this
  77. // search result.
  78. [MinVersion=5] pending_receiver<SearchResultConsumer>? receiver@21;
  79. // The accessibility label to use for the second image line, if one exists.
  80. [MinVersion=3] mojo_base.mojom.String16? description_a11y_label@19;
  81. // The contents of the result. Used to display the result.
  82. mojo_base.mojom.String16? contents@9;
  83. // Text type of the contents, if any.
  84. [MinVersion=2] TextType contents_type@16;
  85. // Additional contents for the result. Used to display the result.
  86. mojo_base.mojom.String16? additional_contents@10;
  87. // Text type of the additional contents, if any.
  88. [MinVersion=2] TextType additional_contents_type@17;
  89. // Description of the result. Used to display the result.
  90. mojo_base.mojom.String16? description@11;
  91. // Text type of the description, if any.
  92. [MinVersion=2] TextType description_type@18;
  93. // Additional description for the result. Used to display the result.
  94. mojo_base.mojom.String16? additional_description@12;
  95. // Text type of the additional description, if any.
  96. TextType additional_description_type@13;
  97. [Stable, Extensible]
  98. enum OptionalBool {
  99. kUnset,
  100. kFalse,
  101. kTrue,
  102. };
  103. // Enum representing the Omnibox result subtype.
  104. [Stable, Extensible]
  105. enum OmniboxType {
  106. [Default] kUnset = 0,
  107. kRichImageDeprecated = 1,
  108. kFaviconDeprecated = 2,
  109. kCalculatorDeprecated = 7,
  110. kBookmark = 3, // A special kind of domain type.
  111. kDomain = 4,
  112. kSearch = 5,
  113. kHistory = 6,
  114. [MinVersion=1] kOpenTab = 8,
  115. };
  116. // Enum representing the search result type as required for metrics logging.
  117. [Stable, Extensible]
  118. enum MetricsType {
  119. [Default] kUnset = 0,
  120. kWhatYouTyped = 1,
  121. kRecentlyVisitedWebsite = 2,
  122. kHistoryTitle = 3,
  123. kSearchWhatYouTyped = 4,
  124. kSearchHistory = 5,
  125. kSearchSuggest = 6,
  126. kSearchSuggestPersonalized = 7,
  127. kBookmark = 8,
  128. kSearchSuggestEntity = 9,
  129. kNavSuggest = 10,
  130. kCalculator = 11,
  131. };
  132. // Enum representing the Omnibox answer subtype.
  133. [Stable, Extensible]
  134. enum AnswerType {
  135. [Default] kUnset = 0,
  136. kDefaultAnswer = 1,
  137. kWeather = 2,
  138. kCurrency = 3,
  139. kDictionary = 4,
  140. kFinance = 5,
  141. kSunrise = 6,
  142. kTranslation = 7,
  143. kWhenIs = 8,
  144. [MinVersion=4] kCalculator = 9,
  145. };
  146. // Enum representing special text types.
  147. [Stable, Extensible]
  148. enum TextType {
  149. [Default] kUnset = 0,
  150. kPositive = 1,
  151. kNegative = 2,
  152. [MinVersion=2] kUrl = 3,
  153. };
  154. // Enum representing the page transition types.
  155. [Stable, Extensible]
  156. enum PageTransition {
  157. [Default] kUnset = 0,
  158. kTyped = 1,
  159. kGenerated = 2,
  160. };
  161. };
  162. // Interface to send results from lacros to ash. Implemented in ash.
  163. // Next min method ID: 1
  164. [Stable, Uuid="ce797aae-286e-4b63-b7b3-090bf5040818"]
  165. interface SearchResultsPublisher {
  166. // Sends search result from lacros to ash. For each query, this will be called
  167. // multiple times, each time it will overwrite the existing results. When all
  168. // results for a query are already sent, the connection will be reset and no
  169. // more results will be sent.
  170. OnSearchResultsReceived@0(SearchStatus status, array<SearchResult>? result);
  171. };
  172. // Interface to send search queries from ash to lacros. Implemented in lacros.
  173. // Next min method ID: 2
  174. [Stable, Uuid="c2d77467-b04d-4b10-8f54-de52c3cbe30d"]
  175. interface SearchController {
  176. // Sends search queries from ash to lacros. If a search query is called while
  177. // there is an in-flight search query, the in-flight search query will be
  178. // cancelled before the new search query is executed.
  179. //
  180. // Returns the pipe to bind to the implementation of `SearchResultsPublisher`
  181. // that should receive the results of this search. Returns a new pipe each
  182. // invocation so that each pipe conceptually represents a single search.
  183. Search@0(mojo_base.mojom.String16 query) =>
  184. (pending_associated_receiver<SearchResultsPublisher> publisher);
  185. };
  186. // Interface to register the search controller. Implemented in ash.
  187. // Next min method ID: 1
  188. [Stable, Uuid="1dc4306b-50af-4b43-a1f0-552e7010971e"]
  189. interface SearchControllerRegistry {
  190. // Lacros can register the search controller to ash so that ash can
  191. // start making calls.
  192. RegisterSearchController@0(
  193. pending_remote<SearchController> search_controller);
  194. };
  195. // Interface implemented by result objects to receive asynchronously-updated
  196. // data for one search result.
  197. // Next min method ID: 1
  198. [Stable, Uuid="d3294d1e-dadb-4bc2-a1ce-5b731f11cce1"]
  199. interface SearchResultConsumer {
  200. // Called once with a favicon if it was successfully asynchronously fetched.
  201. OnFaviconReceived@0(gfx.mojom.ImageSkia favicon);
  202. };