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

Side by Side Diff: chrome/browser/resources/settings/people_page/fingerprint_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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 cr.exportPath('settings'); 5 cr.exportPath('settings');
6 6
7 /** 7 /**
8 * @enum {number} 8 * @enum {number}
9 * These values must be kept in sync with the values in 9 * These values must be kept in sync with the values in
10 * third_party/cros_system_api/dbus/service_constants.h. 10 * third_party/cros_system_api/dbus/service_constants.h.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 * C++ FingerprintHandler. 45 * C++ FingerprintHandler.
46 * @typedef {{ 46 * @typedef {{
47 * fingerprintsList: !Array<string>, 47 * fingerprintsList: !Array<string>,
48 * isMaxed: boolean, 48 * isMaxed: boolean,
49 * }} 49 * }}
50 */ 50 */
51 settings.FingerprintInfo; 51 settings.FingerprintInfo;
52 52
53 cr.define('settings', function() { 53 cr.define('settings', function() {
54 /** @interface */ 54 /** @interface */
55 function FingerprintBrowserProxy() {} 55 class FingerprintBrowserProxy {
56
57 FingerprintBrowserProxy.prototype = {
58 /** 56 /**
59 * @return {!Promise<!settings.FingerprintInfo>} 57 * @return {!Promise<!settings.FingerprintInfo>}
60 */ 58 */
61 getFingerprintsList: function() {}, 59 getFingerprintsList() {}
62 60
63 /** 61 /**
64 * @return {!Promise<number>} 62 * @return {!Promise<number>}
65 */ 63 */
66 getNumFingerprints: function() {}, 64 getNumFingerprints() {}
67 65
68 startEnroll: function() {}, 66 startEnroll() {}
69 67 cancelCurrentEnroll() {}
70 cancelCurrentEnroll: function() {},
71 68
72 /** 69 /**
73 * @param {number} index 70 * @param {number} index
74 * @return {!Promise<string>} 71 * @return {!Promise<string>}
75 */ 72 */
76 getEnrollmentLabel: function(index) {}, 73 getEnrollmentLabel(index) {}
77 74
78 /** 75 /**
79 * @param {number} index 76 * @param {number} index
80 * @return {!Promise<boolean>} 77 * @return {!Promise<boolean>}
81 */ 78 */
82 removeEnrollment: function(index) {}, 79 removeEnrollment(index) {}
83 80
84 /** 81 /**
85 * @param {number} index 82 * @param {number} index
86 * @param {string} newLabel 83 * @param {string} newLabel
87 * @return {!Promise<boolean>} 84 * @return {!Promise<boolean>}
88 */ 85 */
89 changeEnrollmentLabel: function(index, newLabel) {}, 86 changeEnrollmentLabel(index, newLabel) {}
90 87
91 startAuthentication: function() {}, 88 startAuthentication() {}
92 89 endCurrentAuthentication() {}
93 endCurrentAuthentication: function() {},
94 90
95 /** 91 /**
96 * TODO(sammiequon): Temporary function to let the handler know when a 92 * TODO(sammiequon): Temporary function to let the handler know when a
97 * completed scan has been sent via click on the setup fingerprint dialog. 93 * completed scan has been sent via click on the setup fingerprint dialog.
98 * Remove this when real scans are implemented. 94 * Remove this when real scans are implemented.
99 */ 95 */
100 fakeScanComplete: function() {}, 96 fakeScanComplete() {}
101 }; 97 }
102 98
103 /** 99 /**
104 * @constructor
105 * @implements {settings.FingerprintBrowserProxy} 100 * @implements {settings.FingerprintBrowserProxy}
106 */ 101 */
107 function FingerprintBrowserProxyImpl() {} 102 class FingerprintBrowserProxyImpl {
108 cr.addSingletonGetter(FingerprintBrowserProxyImpl);
109
110 FingerprintBrowserProxyImpl.prototype = {
111 /** @override */ 103 /** @override */
112 getFingerprintsList: function() { 104 getFingerprintsList() {
113 return cr.sendWithPromise('getFingerprintsList'); 105 return cr.sendWithPromise('getFingerprintsList');
114 }, 106 }
115 107
116 /** @override */ 108 /** @override */
117 getNumFingerprints: function() { 109 getNumFingerprints() {
118 return cr.sendWithPromise('getNumFingerprints'); 110 return cr.sendWithPromise('getNumFingerprints');
119 }, 111 }
120 112
121 /** @override */ 113 /** @override */
122 startEnroll: function() { 114 startEnroll() {
123 chrome.send('startEnroll'); 115 chrome.send('startEnroll');
124 }, 116 }
125 117
126 /** @override */ 118 /** @override */
127 cancelCurrentEnroll: function() { 119 cancelCurrentEnroll() {
128 chrome.send('cancelCurrentEnroll'); 120 chrome.send('cancelCurrentEnroll');
129 }, 121 }
130 122
131 /** @override */ 123 /** @override */
132 getEnrollmentLabel: function(index) { 124 getEnrollmentLabel(index) {
133 return cr.sendWithPromise('getEnrollmentLabel'); 125 return cr.sendWithPromise('getEnrollmentLabel');
134 }, 126 }
135 127
136 /** @override */ 128 /** @override */
137 removeEnrollment: function(index) { 129 removeEnrollment(index) {
138 return cr.sendWithPromise('removeEnrollment', index); 130 return cr.sendWithPromise('removeEnrollment', index);
139 }, 131 }
140 132
141 /** @override */ 133 /** @override */
142 changeEnrollmentLabel: function(index, newLabel) { 134 changeEnrollmentLabel(index, newLabel) {
143 return cr.sendWithPromise('changeEnrollmentLabel', index, newLabel); 135 return cr.sendWithPromise('changeEnrollmentLabel', index, newLabel);
144 }, 136 }
145 137
146 /** @override */ 138 /** @override */
147 startAuthentication: function() { 139 startAuthentication() {
148 chrome.send('startAuthentication'); 140 chrome.send('startAuthentication');
149 }, 141 }
150 142
151 /** @override */ 143 /** @override */
152 endCurrentAuthentication: function() { 144 endCurrentAuthentication() {
153 chrome.send('endCurrentAuthentication'); 145 chrome.send('endCurrentAuthentication');
154 }, 146 }
155 147
156 /** @override */ 148 /** @override */
157 fakeScanComplete: function() { 149 fakeScanComplete() {
158 chrome.send('fakeScanComplete'); 150 chrome.send('fakeScanComplete');
159 }, 151 }
160 }; 152 }
153
154 cr.addSingletonGetter(FingerprintBrowserProxyImpl);
161 155
162 return { 156 return {
163 FingerprintBrowserProxy: FingerprintBrowserProxy, 157 FingerprintBrowserProxy: FingerprintBrowserProxy,
164 FingerprintBrowserProxyImpl: FingerprintBrowserProxyImpl, 158 FingerprintBrowserProxyImpl: FingerprintBrowserProxyImpl,
165 }; 159 };
166 }); 160 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698