| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview A helper object used from the "Manage search engines" section | 6 * @fileoverview A helper object used from the "Manage search engines" section |
| 7 * to interact with the browser. | 7 * to interact with the browser. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @typedef {{ | 29 * @typedef {{ |
| 30 * defaults: !Array<!SearchEngine>, | 30 * defaults: !Array<!SearchEngine>, |
| 31 * others: !Array<!SearchEngine>, | 31 * others: !Array<!SearchEngine>, |
| 32 * extensions: !Array<!SearchEngine> | 32 * extensions: !Array<!SearchEngine> |
| 33 * }} | 33 * }} |
| 34 */ | 34 */ |
| 35 var SearchEnginesInfo; | 35 var SearchEnginesInfo; |
| 36 | 36 |
| 37 /** |
| 38 * @typedef {{ |
| 39 * allowed: boolean, |
| 40 * enabled: boolean, |
| 41 * alwaysOn: boolean, |
| 42 * errorMessage: string, |
| 43 * userName: string, |
| 44 * historyEnabled: boolean |
| 45 * }} |
| 46 */ |
| 47 var SearchPageHotwordInfo; |
| 48 |
| 37 cr.define('settings', function() { | 49 cr.define('settings', function() { |
| 38 /** @interface */ | 50 /** @interface */ |
| 39 function SearchEnginesBrowserProxy() {} | 51 function SearchEnginesBrowserProxy() {} |
| 40 | 52 |
| 41 SearchEnginesBrowserProxy.prototype = { | 53 SearchEnginesBrowserProxy.prototype = { |
| 42 /** @param {number} modelIndex */ | 54 /** @param {number} modelIndex */ |
| 43 setDefaultSearchEngine: function(modelIndex) {}, | 55 setDefaultSearchEngine: function(modelIndex) {}, |
| 44 | 56 |
| 45 /** @param {number} modelIndex */ | 57 /** @param {number} modelIndex */ |
| 46 removeSearchEngine: function(modelIndex) {}, | 58 removeSearchEngine: function(modelIndex) {}, |
| 47 | 59 |
| 48 /** @param {number} modelIndex */ | 60 /** @param {number} modelIndex */ |
| 49 searchEngineEditStarted: function(modelIndex) {}, | 61 searchEngineEditStarted: function(modelIndex) {}, |
| 50 | 62 |
| 51 searchEngineEditCancelled: function() {}, | 63 searchEngineEditCancelled: function() {}, |
| 52 | 64 |
| 53 /** | 65 /** |
| 54 * @param {string} searchEngine | 66 * @param {string} searchEngine |
| 55 * @param {string} keyword | 67 * @param {string} keyword |
| 56 * @param {string} queryUrl | 68 * @param {string} queryUrl |
| 57 */ | 69 */ |
| 58 searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) {}, | 70 searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) {}, |
| 59 | 71 |
| 60 /** | 72 /** @return {!Promise<!SearchEnginesInfo>} */ |
| 61 * @return {!Promise<!SearchEnginesInfo>} | |
| 62 */ | |
| 63 getSearchEnginesList: function() {}, | 73 getSearchEnginesList: function() {}, |
| 64 | 74 |
| 65 /** | 75 /** |
| 66 * @param {string} fieldName | 76 * @param {string} fieldName |
| 67 * @param {string} fieldValue | 77 * @param {string} fieldValue |
| 68 * @return {!Promise<boolean>} | 78 * @return {!Promise<boolean>} |
| 69 */ | 79 */ |
| 70 validateSearchEngineInput: function(fieldName, fieldValue) {}, | 80 validateSearchEngineInput: function(fieldName, fieldValue) {}, |
| 81 |
| 82 /** @return {!Promise<!SearchPageHotwordInfo>} */ |
| 83 getHotwordInfo: function() {}, |
| 84 |
| 85 /** @param {boolean} enabled */ |
| 86 setHotwordSearchEnabled: function(enabled) {}, |
| 71 }; | 87 }; |
| 72 | 88 |
| 73 /** | 89 /** |
| 74 * @constructor | 90 * @constructor |
| 75 * @implements {settings.SearchEnginesBrowserProxy} | 91 * @implements {settings.SearchEnginesBrowserProxy} |
| 76 */ | 92 */ |
| 77 function SearchEnginesBrowserProxyImpl() {} | 93 function SearchEnginesBrowserProxyImpl() {} |
| 78 // The singleton instance_ is replaced with a test version of this wrapper | 94 // The singleton instance_ is replaced with a test version of this wrapper |
| 79 // during testing. | 95 // during testing. |
| 80 cr.addSingletonGetter(SearchEnginesBrowserProxyImpl); | 96 cr.addSingletonGetter(SearchEnginesBrowserProxyImpl); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 110 /** @override */ | 126 /** @override */ |
| 111 getSearchEnginesList: function() { | 127 getSearchEnginesList: function() { |
| 112 return cr.sendWithPromise('getSearchEnginesList'); | 128 return cr.sendWithPromise('getSearchEnginesList'); |
| 113 }, | 129 }, |
| 114 | 130 |
| 115 /** @override */ | 131 /** @override */ |
| 116 validateSearchEngineInput: function(fieldName, fieldValue) { | 132 validateSearchEngineInput: function(fieldName, fieldValue) { |
| 117 return cr.sendWithPromise( | 133 return cr.sendWithPromise( |
| 118 'validateSearchEngineInput', fieldName, fieldValue); | 134 'validateSearchEngineInput', fieldName, fieldValue); |
| 119 }, | 135 }, |
| 136 |
| 137 /** @override */ |
| 138 getHotwordInfo: function() { |
| 139 return cr.sendWithPromise('getHotwordInfo'); |
| 140 }, |
| 141 |
| 142 /** @override */ |
| 143 setHotwordSearchEnabled: function(enabled) { |
| 144 chrome.send('setHotwordSearchEnabled', [enabled]); |
| 145 }, |
| 120 }; | 146 }; |
| 121 | 147 |
| 122 return { | 148 return { |
| 123 SearchEnginesBrowserProxy: SearchEnginesBrowserProxy, | 149 SearchEnginesBrowserProxy: SearchEnginesBrowserProxy, |
| 124 SearchEnginesBrowserProxyImpl: SearchEnginesBrowserProxyImpl, | 150 SearchEnginesBrowserProxyImpl: SearchEnginesBrowserProxyImpl, |
| 125 }; | 151 }; |
| 126 }); | 152 }); |
| OLD | NEW |