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

Side by Side Diff: chrome/browser/resources/settings/on_startup_page/startup_urls_page_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 * @typedef {{ 6 * @typedef {{
7 * modelIndex: number, 7 * modelIndex: number,
8 * title: string, 8 * title: string,
9 * tooltip: string, 9 * tooltip: string,
10 * url: string 10 * url: string
11 * }} 11 * }}
12 */ 12 */
13 var StartupPageInfo; 13 var StartupPageInfo;
14 14
15 cr.define('settings', function() { 15 cr.define('settings', function() {
16 /** @interface */ 16 /** @interface */
17 function StartupUrlsPageBrowserProxy() {} 17 class StartupUrlsPageBrowserProxy {
18 18 loadStartupPages() {}
19 StartupUrlsPageBrowserProxy.prototype = { 19 useCurrentPages() {}
20 loadStartupPages: assertNotReached,
21
22 useCurrentPages: assertNotReached,
23 20
24 /** 21 /**
25 * @param {string} url 22 * @param {string} url
26 * @return {!Promise<boolean>} Whether the URL is valid. 23 * @return {!Promise<boolean>} Whether the URL is valid.
27 */ 24 */
28 validateStartupPage: assertNotReached, 25 validateStartupPage(url) {}
29 26
30 /** 27 /**
31 * @param {string} url 28 * @param {string} url
32 * @return {!Promise<boolean>} Whether the URL was actually added, or 29 * @return {!Promise<boolean>} Whether the URL was actually added, or
33 * ignored because it was invalid. 30 * ignored because it was invalid.
34 */ 31 */
35 addStartupPage: assertNotReached, 32 addStartupPage(url) {}
36 33
37 /** 34 /**
38 * @param {number} modelIndex 35 * @param {number} modelIndex
39 * @param {string} url 36 * @param {string} url
40 * @return {!Promise<boolean>} Whether the URL was actually edited, or 37 * @return {!Promise<boolean>} Whether the URL was actually edited, or
41 * ignored because it was invalid. 38 * ignored because it was invalid.
42 */ 39 */
43 editStartupPage: assertNotReached, 40 editStartupPage(modelIndex, url) {}
44 41
45 /** @param {number} index */ 42 /** @param {number} index */
46 removeStartupPage: assertNotReached, 43 removeStartupPage(index) {}
47 }; 44 }
48 45
49 /** 46 /**
50 * @implements {settings.StartupUrlsPageBrowserProxy} 47 * @implements {settings.StartupUrlsPageBrowserProxy}
51 * @constructor
52 */ 48 */
53 function StartupUrlsPageBrowserProxyImpl() {} 49 class StartupUrlsPageBrowserProxyImpl {
50 /** @override */
51 loadStartupPages() {
52 chrome.send('onStartupPrefsPageLoad');
53 }
54
55 /** @override */
56 useCurrentPages() {
57 chrome.send('setStartupPagesToCurrentPages');
58 }
59
60 /** @override */
61 validateStartupPage(url) {
62 return cr.sendWithPromise('validateStartupPage', url);
63 }
64
65 /** @override */
66 addStartupPage(url) {
67 return cr.sendWithPromise('addStartupPage', url);
68 }
69
70 /** @override */
71 editStartupPage(modelIndex, url) {
72 return cr.sendWithPromise('editStartupPage', modelIndex, url);
73 }
74
75 /** @override */
76 removeStartupPage(index) {
77 chrome.send('removeStartupPage', [index]);
78 }
79 }
54 80
55 cr.addSingletonGetter(StartupUrlsPageBrowserProxyImpl); 81 cr.addSingletonGetter(StartupUrlsPageBrowserProxyImpl);
56 82
57 StartupUrlsPageBrowserProxyImpl.prototype = {
58 /** @override */
59 loadStartupPages: function() {
60 chrome.send('onStartupPrefsPageLoad');
61 },
62
63 /** @override */
64 useCurrentPages: function() {
65 chrome.send('setStartupPagesToCurrentPages');
66 },
67
68 /** @override */
69 validateStartupPage: function(url) {
70 return cr.sendWithPromise('validateStartupPage', url);
71 },
72
73 /** @override */
74 addStartupPage: function(url) {
75 return cr.sendWithPromise('addStartupPage', url);
76 },
77
78 /** @override */
79 editStartupPage: function(modelIndex, url) {
80 return cr.sendWithPromise('editStartupPage', modelIndex, url);
81 },
82
83 /** @override */
84 removeStartupPage: function(index) {
85 chrome.send('removeStartupPage', [index]);
86 },
87 };
88
89 return { 83 return {
90 StartupUrlsPageBrowserProxy: StartupUrlsPageBrowserProxy, 84 StartupUrlsPageBrowserProxy: StartupUrlsPageBrowserProxy,
91 StartupUrlsPageBrowserProxyImpl: StartupUrlsPageBrowserProxyImpl, 85 StartupUrlsPageBrowserProxyImpl: StartupUrlsPageBrowserProxyImpl,
92 }; 86 };
93 }); 87 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698