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 dictionary HotwordState { | |
| 15 // Availability of hotword features. | |
| 16 HotwordFeature[] availability; | |
| 17 | |
| 18 // State of the audio history; present if the availability includes | |
| 19 // audio history. | |
| 20 DOMString? audioHistoryState; | |
| 21 | |
| 22 // Error message when fetching hotword state if an error occurred. | |
| 23 DOMString? errorMsg; | |
| 24 }; | |
| 25 | |
| 9 dictionary SearchEngine { | 26 dictionary SearchEngine { |
| 10 // The unique ID of the engine in the list. | 27 // The unique ID of the engine in the list. |
| 11 DOMString guid; | 28 DOMString guid; |
| 12 | 29 |
| 13 // The name of the engine. | 30 // The name of the engine. |
| 14 DOMString name; | 31 DOMString name; |
| 15 | 32 |
| 33 // The keyword for the engine. | |
| 34 DOMString keyword; | |
| 35 | |
| 36 // The URL of the engine. | |
| 37 DOMString url; | |
| 38 | |
| 16 // Whether the engine is the selected a.k.a. "default" search engine. | 39 // Whether the engine is the selected a.k.a. "default" search engine. |
| 17 boolean? isSelected; | 40 boolean? isSelected; |
| 18 }; | 41 }; |
| 19 | 42 |
| 43 callback HotwordStateCallback = void (HotwordState state); | |
| 20 callback SearchEnginesCallback = void (SearchEngine[] engines); | 44 callback SearchEnginesCallback = void (SearchEngine[] engines); |
| 21 | 45 |
| 22 interface Functions { | 46 interface Functions { |
| 23 // Gets a list of the "default” search engines. | 47 // Gets a list of the "default" search engines. |
| 24 // Exactly one of the values should have default == true. | 48 // Exactly one of the values should have default == true. |
| 25 static void getDefaultSearchEngines(SearchEnginesCallback callback); | 49 static void getDefaultSearchEngines(SearchEnginesCallback callback); |
| 26 | 50 |
| 27 // Sets the search engine with the given GUID as the selected default. | 51 // Sets the search engine with the given GUID as the selected default. |
| 28 static void setSelectedSearchEngine(DOMString guid); | 52 static void setSelectedSearchEngine(DOMString guid); |
| 53 | |
| 54 // Gets a list of the "other" search engines. | |
| 55 static void getOtherSearchEngines(SearchEnginesCallback callback); | |
|
stevenjb
2015/04/28 17:16:39
nit: group this with getDefaultSearchEngines
Oren Blasberg
2015/04/28 18:44:01
Done.
| |
| 56 | |
| 57 // Adds a new "other" (non-default) search engine with the given name, | |
| 58 // keyword, and URL. | |
| 59 static void addOtherSearchEngine( | |
| 60 DOMString name, DOMString keyword, DOMString url); | |
| 61 | |
| 62 // Updates the search engine that has the given GUID, with the given name, | |
| 63 // keyword, and URL. | |
| 64 static void updateSearchEngine( | |
| 65 DOMString guid, DOMString name, DOMString keyword, DOMString url); | |
|
not at google - send to devlin
2015/04/28 16:48:46
Your API - but consider using single objects with
Oren Blasberg
2015/04/28 18:44:01
That's definitely a fair point. We already have th
| |
| 66 | |
| 67 // Removes the search engine with the given GUID. | |
| 68 static void removeSearchEngine(DOMString guid); | |
| 69 | |
| 70 // Gets the hotword state. | |
| 71 static void getHotwordState(HotwordStateCallback callback); | |
| 72 | |
| 73 // Opts in to hotwording; behavior depends on whether retrain is needed. | |
|
stevenjb
2015/04/28 17:16:39
Could you elaborated on "behavior depends on wheth
Oren Blasberg
2015/04/28 18:44:01
Done.
| |
| 74 static void optIntoHotwording(boolean retrain); | |
| 29 }; | 75 }; |
| 30 | 76 |
| 31 interface Events { | 77 interface Events { |
| 32 // Fires when the list of default search engines changes or | 78 // Fires when the list of default search engines changes or |
| 33 // when the user selects a preferred default search engine. | 79 // when the user selects a preferred default search engine. The new list of |
| 80 // "default" engines is passed along. | |
| 34 static void onDefaultSearchEnginesChanged(SearchEngine[] engines); | 81 static void onDefaultSearchEnginesChanged(SearchEngine[] engines); |
| 82 | |
| 83 // Fires when the list of "other" search engines changes. The new list | |
| 84 // of "other" engines is passed along. | |
| 85 static void onOtherSearchEnginesChanged(SearchEngine[] engines); | |
| 35 }; | 86 }; |
| 36 }; | 87 }; |
| OLD | NEW |