OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
8 | 8 |
9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
10 // PasswordManager class: | 10 // PasswordManager class: |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 * Updates the data model for the password exceptions list with the values | 177 * Updates the data model for the password exceptions list with the values |
178 * from |entries|. | 178 * from |entries|. |
179 * @param {Array} entries The list of password exception data. | 179 * @param {Array} entries The list of password exception data. |
180 */ | 180 */ |
181 setPasswordExceptionsList_: function(entries) { | 181 setPasswordExceptionsList_: function(entries) { |
182 this.passwordExceptionsList_.dataModel = new ArrayDataModel(entries); | 182 this.passwordExceptionsList_.dataModel = new ArrayDataModel(entries); |
183 this.updateListVisibility_(this.passwordExceptionsList_); | 183 this.updateListVisibility_(this.passwordExceptionsList_); |
184 }, | 184 }, |
185 | 185 |
186 /** | 186 /** |
| 187 * Removes the show password button. This is called by the backend when |
| 188 * we are running in an environment that does not support showing |
| 189 * passwords, such as Windows Metro |
| 190 */ |
| 191 disableShowPassword_: function() { |
| 192 this.savedPasswordsList_.disableShowPassword(); |
| 193 }, |
| 194 |
| 195 /** |
187 * Reveals the password for a saved password entry. This is called by the | 196 * Reveals the password for a saved password entry. This is called by the |
188 * backend after it has authenticated the user. | 197 * backend after it has authenticated the user. |
189 * @param {number} index The original index of the entry in the model. | 198 * @param {number} index The original index of the entry in the model. |
190 * @param {string} password The saved password. | 199 * @param {string} password The saved password. |
191 */ | 200 */ |
192 showPassword_: function(index, password) { | 201 showPassword_: function(index, password) { |
193 var model = this.savedPasswordsList_.dataModel; | 202 var model = this.savedPasswordsList_.dataModel; |
194 if (this.lastQuery_) { | 203 if (this.lastQuery_) { |
195 // When a filter is active, |index| does not represent the current | 204 // When a filter is active, |index| does not represent the current |
196 // index in the model, but each entry stores its original index, so | 205 // index in the model, but each entry stores its original index, so |
(...skipping 29 matching lines...) Expand all Loading... |
226 }; | 235 }; |
227 | 236 |
228 PasswordManager.requestShowPassword = function(index) { | 237 PasswordManager.requestShowPassword = function(index) { |
229 chrome.send('requestShowPassword', [index]); | 238 chrome.send('requestShowPassword', [index]); |
230 }; | 239 }; |
231 | 240 |
232 // Forward public APIs to private implementations on the singleton instance. | 241 // Forward public APIs to private implementations on the singleton instance. |
233 [ | 242 [ |
234 'setSavedPasswordsList', | 243 'setSavedPasswordsList', |
235 'setPasswordExceptionsList', | 244 'setPasswordExceptionsList', |
236 'showPassword' | 245 'showPassword', |
| 246 'disableShowPassword' |
237 ].forEach(function(name) { | 247 ].forEach(function(name) { |
238 PasswordManager[name] = function() { | 248 PasswordManager[name] = function() { |
239 var instance = PasswordManager.getInstance(); | 249 var instance = PasswordManager.getInstance(); |
240 return instance[name + '_'].apply(instance, arguments); | 250 return instance[name + '_'].apply(instance, arguments); |
241 }; | 251 }; |
242 }); | 252 }); |
243 | 253 |
244 // Export | 254 // Export |
245 return { | 255 return { |
246 PasswordManager: PasswordManager | 256 PasswordManager: PasswordManager |
247 }; | 257 }; |
248 | 258 |
249 }); | 259 }); |
OLD | NEW |