| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 // Use the <code>chrome.searchEnginesPrivate</code> API to get or set | |
| 6 // preferences from the settings UI. | |
| 7 namespace searchEnginesPrivate { | |
| 8 | |
| 9 // Types of hotword features that are available. | |
| 10 enum HotwordFeature { | |
| 11 SEARCH, ALWAYS_ON, RETRAIN_LINK, AUDIO_HISTORY | |
| 12 }; | |
| 13 | |
| 14 // Types of search engines. | |
| 15 enum SearchEngineType { | |
| 16 DEFAULT, OTHER | |
| 17 }; | |
| 18 | |
| 19 dictionary HotwordState { | |
| 20 // Availability of hotword features. | |
| 21 HotwordFeature[] availability; | |
| 22 | |
| 23 // State of the audio history; present if the availability includes | |
| 24 // audio history. | |
| 25 DOMString? audioHistoryState; | |
| 26 | |
| 27 // Error message when fetching hotword state if an error occurred. | |
| 28 DOMString? errorMsg; | |
| 29 }; | |
| 30 | |
| 31 dictionary SearchEngine { | |
| 32 // The unique ID of the engine in the list. | |
| 33 DOMString guid; | |
| 34 | |
| 35 // The name of the engine. | |
| 36 DOMString name; | |
| 37 | |
| 38 // The keyword for the engine. | |
| 39 DOMString keyword; | |
| 40 | |
| 41 // The URL of the engine. | |
| 42 DOMString url; | |
| 43 | |
| 44 // The type of the engine. | |
| 45 SearchEngineType type; | |
| 46 | |
| 47 // Whether the engine is the selected a.k.a. "default" search engine. | |
| 48 boolean? isSelected; | |
| 49 }; | |
| 50 | |
| 51 callback HotwordStateCallback = void (HotwordState state); | |
| 52 callback SearchEnginesCallback = void (SearchEngine[] engines); | |
| 53 | |
| 54 interface Functions { | |
| 55 // Gets a list of the search engines. | |
| 56 // Exactly one of the values should have default == true. | |
| 57 static void getSearchEngines(SearchEnginesCallback callback); | |
| 58 | |
| 59 // Sets the search engine with the given GUID as the selected default. | |
| 60 static void setSelectedSearchEngine(DOMString guid); | |
| 61 | |
| 62 // Adds a new "other" (non-default) search engine with the given name, | |
| 63 // keyword, and URL. | |
| 64 static void addOtherSearchEngine( | |
| 65 DOMString name, DOMString keyword, DOMString url); | |
| 66 | |
| 67 // Updates the search engine that has the given GUID, with the given name, | |
| 68 // keyword, and URL. | |
| 69 static void updateSearchEngine( | |
| 70 DOMString guid, DOMString name, DOMString keyword, DOMString url); | |
| 71 | |
| 72 // Removes the search engine with the given GUID. | |
| 73 static void removeSearchEngine(DOMString guid); | |
| 74 | |
| 75 // Gets the hotword state. | |
| 76 static void getHotwordState(HotwordStateCallback callback); | |
| 77 | |
| 78 // Opts in to hotwording; |retrain| indicates whether the user wants to | |
| 79 // retrain the hotword system with their voice by launching the audio | |
| 80 // verification app. | |
| 81 static void optIntoHotwording(boolean retrain); | |
| 82 }; | |
| 83 | |
| 84 interface Events { | |
| 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); | |
| 88 }; | |
| 89 }; | |
| OLD | NEW |