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 'password-edit-dialog' is the dialog that allows showing a | 6 * @fileoverview 'password-edit-dialog' is the dialog that allows showing a |
7 * saved password. | 7 * saved password. |
8 */ | 8 */ |
9 | 9 |
10 (function() { | 10 (function() { |
11 'use strict'; | 11 'use strict'; |
12 | 12 |
13 Polymer({ | 13 Polymer({ |
14 is: 'password-edit-dialog', | 14 is: 'password-edit-dialog', |
15 | 15 |
16 behaviors: [I18nBehavior], | |
dschuyler
2017/02/15 20:12:15
With $i18nPolymer this behavior can be removed.
hcarmona
2017/02/15 21:52:11
Done.
| |
17 | |
16 properties: { | 18 properties: { |
17 /** | 19 /** |
18 * The password that is being displayed. | 20 * The password that is being displayed. |
19 * @type {!chrome.passwordsPrivate.PasswordUiEntry} | 21 * @type {!chrome.passwordsPrivate.PasswordUiEntry} |
20 */ | 22 */ |
21 item: Object, | 23 item: Object, |
22 | 24 |
23 /** Holds the plaintext password when requested. */ | 25 /** Holds the plaintext password when requested. */ |
24 password: String, | 26 password: String, |
25 }, | 27 }, |
(...skipping 13 matching lines...) Expand all Loading... | |
39 * Gets the password input's type. Should be 'text' when password is visible | 41 * Gets the password input's type. Should be 'text' when password is visible |
40 * and 'password' when it's not. | 42 * and 'password' when it's not. |
41 * @param {string} password | 43 * @param {string} password |
42 * @private | 44 * @private |
43 */ | 45 */ |
44 getPasswordInputType_: function(password) { | 46 getPasswordInputType_: function(password) { |
45 return password ? 'text' : 'password'; | 47 return password ? 'text' : 'password'; |
46 }, | 48 }, |
47 | 49 |
48 /** | 50 /** |
51 * Gets the title text for the show/hide icon. | |
52 * @param {string} password | |
53 * @private | |
54 */ | |
55 showPasswordTitle_: function(password) { | |
56 return password ? this.i18n('hidePassword') : this.i18n('showPassword'); | |
dschuyler
2017/02/15 20:12:15
With $i18nPolymer this could become:
showPasswordT
hcarmona
2017/02/15 21:52:11
Sweet. Done.
| |
57 }, | |
58 | |
59 /** | |
49 * Gets the text of the password. Will use the value of |password| unless it | 60 * Gets the text of the password. Will use the value of |password| unless it |
50 * cannot be shown, in which case it will be spaces. | 61 * cannot be shown, in which case it will be spaces. |
51 * @param {!chrome.passwordsPrivate.PasswordUiEntry} item | 62 * @param {!chrome.passwordsPrivate.PasswordUiEntry} item |
52 * @param {string} password | 63 * @param {string} password |
53 * @private | 64 * @private |
54 */ | 65 */ |
55 getPassword_: function(item, password) { | 66 getPassword_: function(item, password) { |
56 if (password) | 67 if (password) |
57 return password; | 68 return password; |
58 return item ? ' '.repeat(item.numCharactersInPassword) : ''; | 69 return item ? ' '.repeat(item.numCharactersInPassword) : ''; |
(...skipping 22 matching lines...) Expand all Loading... | |
81 /** | 92 /** |
82 * Handler for tapping the save button. | 93 * Handler for tapping the save button. |
83 * @private | 94 * @private |
84 */ | 95 */ |
85 onSaveButtonTap_: function() { | 96 onSaveButtonTap_: function() { |
86 // TODO(hcarmona): what to save? | 97 // TODO(hcarmona): what to save? |
87 this.close(); | 98 this.close(); |
88 }, | 99 }, |
89 }); | 100 }); |
90 })(); | 101 })(); |
OLD | NEW |