Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: chrome/browser/resources/settings/search_engines_page/search_engines_browser_proxy.js

Issue 2954863003: MD Settings: Convert all browser proxies to use ES6 class syntax. (Closed)
Patch Set: Remove @constructor annotations. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 * alwaysOn: boolean, 44 * alwaysOn: boolean,
45 * errorMessage: string, 45 * errorMessage: string,
46 * userName: string, 46 * userName: string,
47 * historyEnabled: boolean 47 * historyEnabled: boolean
48 * }} 48 * }}
49 */ 49 */
50 var SearchPageHotwordInfo; 50 var SearchPageHotwordInfo;
51 51
52 cr.define('settings', function() { 52 cr.define('settings', function() {
53 /** @interface */ 53 /** @interface */
54 function SearchEnginesBrowserProxy() {} 54 class SearchEnginesBrowserProxy {
55
56 SearchEnginesBrowserProxy.prototype = {
57 /** @param {number} modelIndex */ 55 /** @param {number} modelIndex */
58 setDefaultSearchEngine: function(modelIndex) {}, 56 setDefaultSearchEngine(modelIndex) {}
59 57
60 /** @param {number} modelIndex */ 58 /** @param {number} modelIndex */
61 removeSearchEngine: function(modelIndex) {}, 59 removeSearchEngine(modelIndex) {}
62 60
63 /** @param {number} modelIndex */ 61 /** @param {number} modelIndex */
64 searchEngineEditStarted: function(modelIndex) {}, 62 searchEngineEditStarted(modelIndex) {}
65 63
66 searchEngineEditCancelled: function() {}, 64 searchEngineEditCancelled() {}
67 65
68 /** 66 /**
69 * @param {string} searchEngine 67 * @param {string} searchEngine
70 * @param {string} keyword 68 * @param {string} keyword
71 * @param {string} queryUrl 69 * @param {string} queryUrl
72 */ 70 */
73 searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) {}, 71 searchEngineEditCompleted(searchEngine, keyword, queryUrl) {}
74 72
75 /** @return {!Promise<!SearchEnginesInfo>} */ 73 /** @return {!Promise<!SearchEnginesInfo>} */
76 getSearchEnginesList: function() {}, 74 getSearchEnginesList() {}
77 75
78 /** 76 /**
79 * @param {string} fieldName 77 * @param {string} fieldName
80 * @param {string} fieldValue 78 * @param {string} fieldValue
81 * @return {!Promise<boolean>} 79 * @return {!Promise<boolean>}
82 */ 80 */
83 validateSearchEngineInput: function(fieldName, fieldValue) {}, 81 validateSearchEngineInput(fieldName, fieldValue) {}
84 82
85 /** @return {!Promise<!SearchPageHotwordInfo>} */ 83 /** @return {!Promise<!SearchPageHotwordInfo>} */
86 getHotwordInfo: function() {}, 84 getHotwordInfo() {}
87 85
88 /** @param {boolean} enabled */ 86 /** @param {boolean} enabled */
89 setHotwordSearchEnabled: function(enabled) {}, 87 setHotwordSearchEnabled(enabled) {}
90 88
91 /** @return {!Promise<boolean>} */ 89 /** @return {!Promise<boolean>} */
92 getGoogleNowAvailability: function() {}, 90 getGoogleNowAvailability() {}
93 }; 91 }
94 92
95 /** 93 /**
96 * @constructor
97 * @implements {settings.SearchEnginesBrowserProxy} 94 * @implements {settings.SearchEnginesBrowserProxy}
98 */ 95 */
99 function SearchEnginesBrowserProxyImpl() {} 96 class SearchEnginesBrowserProxyImpl {
100 // The singleton instance_ is replaced with a test version of this wrapper
101 // during testing.
102 cr.addSingletonGetter(SearchEnginesBrowserProxyImpl);
103
104 SearchEnginesBrowserProxyImpl.prototype = {
105 /** @override */ 97 /** @override */
106 setDefaultSearchEngine: function(modelIndex) { 98 setDefaultSearchEngine(modelIndex) {
107 chrome.send('setDefaultSearchEngine', [modelIndex]); 99 chrome.send('setDefaultSearchEngine', [modelIndex]);
108 }, 100 }
109 101
110 /** @override */ 102 /** @override */
111 removeSearchEngine: function(modelIndex) { 103 removeSearchEngine(modelIndex) {
112 chrome.send('removeSearchEngine', [modelIndex]); 104 chrome.send('removeSearchEngine', [modelIndex]);
113 }, 105 }
114 106
115 /** @override */ 107 /** @override */
116 searchEngineEditStarted: function(modelIndex) { 108 searchEngineEditStarted(modelIndex) {
117 chrome.send('searchEngineEditStarted', [modelIndex]); 109 chrome.send('searchEngineEditStarted', [modelIndex]);
118 }, 110 }
119 111
120 /** @override */ 112 /** @override */
121 searchEngineEditCancelled: function() { 113 searchEngineEditCancelled() {
122 chrome.send('searchEngineEditCancelled'); 114 chrome.send('searchEngineEditCancelled');
123 }, 115 }
124 116
125 /** @override */ 117 /** @override */
126 searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) { 118 searchEngineEditCompleted(searchEngine, keyword, queryUrl) {
127 chrome.send('searchEngineEditCompleted', [ 119 chrome.send('searchEngineEditCompleted', [
128 searchEngine, 120 searchEngine,
129 keyword, 121 keyword,
130 queryUrl, 122 queryUrl,
131 ]); 123 ]);
132 }, 124 }
133 125
134 /** @override */ 126 /** @override */
135 getSearchEnginesList: function() { 127 getSearchEnginesList() {
136 return cr.sendWithPromise('getSearchEnginesList'); 128 return cr.sendWithPromise('getSearchEnginesList');
137 }, 129 }
138 130
139 /** @override */ 131 /** @override */
140 validateSearchEngineInput: function(fieldName, fieldValue) { 132 validateSearchEngineInput(fieldName, fieldValue) {
141 return cr.sendWithPromise( 133 return cr.sendWithPromise(
142 'validateSearchEngineInput', fieldName, fieldValue); 134 'validateSearchEngineInput', fieldName, fieldValue);
143 }, 135 }
144 136
145 /** @override */ 137 /** @override */
146 getHotwordInfo: function() { 138 getHotwordInfo() {
147 return cr.sendWithPromise('getHotwordInfo'); 139 return cr.sendWithPromise('getHotwordInfo');
148 }, 140 }
149 141
150 /** @override */ 142 /** @override */
151 setHotwordSearchEnabled: function(enabled) { 143 setHotwordSearchEnabled(enabled) {
152 chrome.send('setHotwordSearchEnabled', [enabled]); 144 chrome.send('setHotwordSearchEnabled', [enabled]);
153 }, 145 }
154 146
155 /** @override */ 147 /** @override */
156 getGoogleNowAvailability: function() { 148 getGoogleNowAvailability() {
157 return cr.sendWithPromise('getGoogleNowAvailability'); 149 return cr.sendWithPromise('getGoogleNowAvailability');
158 }, 150 }
159 }; 151 }
152
153 // The singleton instance_ is replaced with a test version of this wrapper
154 // during testing.
155 cr.addSingletonGetter(SearchEnginesBrowserProxyImpl);
160 156
161 return { 157 return {
162 SearchEnginesBrowserProxy: SearchEnginesBrowserProxy, 158 SearchEnginesBrowserProxy: SearchEnginesBrowserProxy,
163 SearchEnginesBrowserProxyImpl: SearchEnginesBrowserProxyImpl, 159 SearchEnginesBrowserProxyImpl: SearchEnginesBrowserProxyImpl,
164 }; 160 };
165 }); 161 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698