| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // An API to listen queries of the Chrome Launcher and provide search results | 5 // An API to listen queries of the Chrome Launcher and provide search results |
| 6 // to it. | 6 // to it. |
| 7 [platforms=("chromeos"), | 7 [platforms=("chromeos"), |
| 8 implemented_in="chrome/browser/chromeos/extensions/launcher_search_provider.h", | 8 implemented_in="chrome/browser/chromeos/extensions/launcher_search_provider.h", |
| 9 nodoc] | 9 nodoc] |
| 10 namespace launcherSearchProvider { | 10 namespace launcherSearchProvider { |
| 11 dictionary SearchResult { | 11 dictionary SearchResult { |
| 12 DOMString itemId; | 12 DOMString itemId; |
| 13 DOMString title; | 13 DOMString title; |
| 14 // If iconUrl is not provided, app/extension icon is used automatically. | 14 // If iconUrl is not provided, app/extension icon is used automatically. |
| 15 DOMString? iconUrl; | 15 DOMString? iconUrl; |
| 16 // Relevance ranges from 0 to 4. 0 is the lowest relevance, 4 is highest. | 16 // Relevance ranges from 0 to 4. 0 is the lowest relevance, 4 is highest. |
| 17 long relevance; | 17 long relevance; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 interface Functions { | 20 interface Functions { |
| 21 // Sets search result of this extension for the query. Setting a new search | 21 // Sets search result of this extension for the query. Setting a new search |
| 22 // results overwrites any previous results of this extension. If queryId is | 22 // results overwrites any previous results of this extension. If queryId is |
| 23 // invalid, the results are discarded. Since the space is limited, it is not | 23 // invalid, the results are discarded. Since the space is limited, it is not |
| 24 // guranteed that all provided results are shown to a user. The search | 24 // guranteed that all provided results are shown to a user. The search |
| 25 // results will be sorted by relevance, with ties broken by the order of the | 25 // results will be sorted by relevance, with ties broken by the order of the |
| 26 // results in this list (highest priority first). | 26 // results in this list (highest priority first). |
| 27 static void setSearchResults(DOMString queryId, SearchResult[] results); | 27 static void setSearchResults(long queryId, SearchResult[] results); |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 interface Events { | 30 interface Events { |
| 31 // Called when a user typed a query. maxResult is the maximum number of | 31 // Called when a user typed a query. maxResult is the maximum number of |
| 32 // results the extension should provide. | 32 // results the extension should provide. |
| 33 static void onQueryStarted(DOMString queryId, | 33 static void onQueryStarted(long queryId, |
| 34 DOMString query, | 34 DOMString query, |
| 35 long maxResult); | 35 long maxResult); |
| 36 | 36 |
| 37 // Called when query of |queryId| is ended. After this call, | 37 // Called when query of |queryId| is ended. After this call, |
| 38 // setSearchResults no longer accept the results for queryId. | 38 // setSearchResults no longer accept the results for queryId. |
| 39 static void onQueryEnded(DOMString queryId); | 39 static void onQueryEnded(long queryId); |
| 40 | 40 |
| 41 // Called when a user clicks a search result which is provided by | 41 // Called when a user clicks a search result which is provided by |
| 42 // setSearchResults. | 42 // setSearchResults. |
| 43 static void onOpenResult(DOMString itemId); | 43 static void onOpenResult(DOMString itemId); |
| 44 }; | 44 }; |
| 45 }; | 45 }; |
| OLD | NEW |