Chromium Code Reviews| 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 // Use the <code>chrome.searchEnginesPrivate</code> API to get or set | 5 // Use the <code>chrome.searchEnginesPrivate</code> API to get or set |
| 6 // preferences from the settings UI. | 6 // preferences from the settings UI. |
| 7 namespace searchEnginesPrivate { | 7 namespace searchEnginesPrivate { |
| 8 | 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 | |
| 9 dictionary SearchEngine { | 31 dictionary SearchEngine { |
| 10 // The unique ID of the engine in the list. | 32 // The unique ID of the engine in the list. |
| 11 DOMString guid; | 33 DOMString guid; |
| 12 | 34 |
| 13 // The name of the engine. | 35 // The name of the engine. |
| 14 DOMString name; | 36 DOMString name; |
| 15 | 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 | |
| 16 // Whether the engine is the selected a.k.a. "default" search engine. | 47 // Whether the engine is the selected a.k.a. "default" search engine. |
| 17 boolean? isSelected; | 48 boolean? isSelected; |
| 18 }; | 49 }; |
| 19 | 50 |
| 51 callback HotwordStateCallback = void (HotwordState state); | |
| 20 callback SearchEnginesCallback = void (SearchEngine[] engines); | 52 callback SearchEnginesCallback = void (SearchEngine[] engines); |
| 21 | 53 |
| 22 interface Functions { | 54 interface Functions { |
| 23 // Gets a list of the "default” search engines. | 55 // Gets a list of the search engines. |
| 24 // Exactly one of the values should have default == true. | 56 // Exactly one of the values should have default == true. |
| 25 static void getDefaultSearchEngines(SearchEnginesCallback callback); | 57 static void getSearchEngines(SearchEnginesCallback callback); |
| 26 | 58 |
| 27 // Sets the search engine with the given GUID as the selected default. | 59 // Sets the search engine with the given GUID as the selected default. |
| 28 static void setSelectedSearchEngine(DOMString guid); | 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 just wants to | |
|
stevenjb
2015/04/28 22:27:11
s/just// ?
| |
| 79 // retrain the hotword system with their voice by launching the audio | |
| 80 // verification app. | |
| 81 static void optIntoHotwording(boolean retrain); | |
| 29 }; | 82 }; |
| 30 | 83 |
| 31 interface Events { | 84 interface Events { |
| 32 // Fires when the list of default search engines changes or | 85 // Fires when the list of search engines changes or when the user selects a |
| 33 // when the user selects a preferred default search engine. | 86 // preferred default search engine. The new list of engines is passed along. |
| 34 static void onDefaultSearchEnginesChanged(SearchEngine[] engines); | 87 static void onSearchEnginesChanged(SearchEngine[] engines); |
| 35 }; | 88 }; |
| 36 }; | 89 }; |
| OLD | NEW |