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
3 // found in the LICENSE file.
5 // Use the <code>chrome.searchEnginesPrivate</code> API to get or set
6 // preferences from the settings UI.
7 namespace searchEnginesPrivate
{
9 // Types of hotword features that are available.
11 SEARCH
, ALWAYS_ON
, RETRAIN_LINK
, AUDIO_HISTORY
14 // Types of search engines.
15 enum SearchEngineType
{
19 dictionary HotwordState
{
20 // Availability of hotword features.
21 HotwordFeature
[] availability
;
23 // State of the audio history; present if the availability includes
25 DOMString? audioHistoryState
;
27 // Error message when fetching hotword state if an error occurred.
31 dictionary SearchEngine
{
32 // The unique ID of the engine in the list.
35 // The name of the engine.
38 // The keyword for the engine.
41 // The URL of the engine.
44 // The type of the engine.
45 SearchEngineType type
;
47 // Whether the engine is the selected a.k.a. "default" search engine.
51 callback HotwordStateCallback
= void (HotwordState state
);
52 callback SearchEnginesCallback
= void (SearchEngine
[] engines
);
55 // Gets a list of the search engines.
56 // Exactly one of the values should have default == true.
57 static
void getSearchEngines
(SearchEnginesCallback
callback);
59 // Sets the search engine with the given GUID as the selected default.
60 static
void setSelectedSearchEngine
(DOMString guid
);
62 // Adds a new "other" (non-default) search engine with the given name,
64 static
void addOtherSearchEngine
(
65 DOMString name
, DOMString keyword
, DOMString url
);
67 // Updates the search engine that has the given GUID, with the given name,
69 static
void updateSearchEngine
(
70 DOMString guid
, DOMString name
, DOMString keyword
, DOMString url
);
72 // Removes the search engine with the given GUID.
73 static
void removeSearchEngine
(DOMString guid
);
75 // Gets the hotword state.
76 static
void getHotwordState
(HotwordStateCallback
callback);
78 // Opts in to hotwording; |retrain| indicates whether the user wants to
79 // retrain the hotword system with their voice by launching the audio
81 static
void optIntoHotwording
(boolean retrain
);
85 // Fires when the list of search engines changes or when the user selects a
86 // preferred default search engine. The new list of engines is passed along.
87 static
void onSearchEnginesChanged
(SearchEngine
[] engines
);