blob: 5f59f72900eb149004b061f731c1c4e8f592a4a6 [file] [log] [blame]
// Copyright 2015 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.
// An API to listen queries of the Chrome Launcher and provide search results
// to it.
namespace launcherSearchProvider {
dictionary SearchResult {
DOMString itemId;
DOMString title;
// If iconUrl is not provided, app/extension icon is used automatically.
DOMString? iconUrl;
// Relevance ranges from 0 to 4. 0 is the lowest relevance, 4 is highest.
long relevance;
interface Functions {
// Sets search result of this extension for the query. Setting a new search
// results overwrites any previous results of this extension. If queryId is
// invalid, the results are discarded. Since the space is limited, it is not
// guranteed that all provided results are shown to a user. The search
// results will be sorted by relevance, with ties broken by the order of the
// results in this list (highest priority first).
static void setSearchResults(long queryId, SearchResult[] results);
interface Events {
// Called when a user typed a query. maxResult is the maximum number of
// results the extension should provide.
static void onQueryStarted(long queryId,
DOMString query,
long maxResult);
// Called when query of |queryId| is ended. After this call,
// setSearchResults no longer accept the results for queryId.
static void onQueryEnded(long queryId);
// Called when a user clicks a search result which is provided by
// setSearchResults.
static void onOpenResult(DOMString itemId);