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

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_subpage.js

Issue 2092763004: [MD Settings] Implement search in material design passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to better match mocks Created 4 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 6 * @fileoverview
7 * 'settings-subpage' shows a subpage beneath a subheader. The header contains 7 * 'settings-subpage' shows a subpage beneath a subheader. The header contains
8 * the subpage title and a back icon. The back icon fires an event which 8 * the subpage title and a back icon. The back icon fires an event which
9 * is caught by settings-animated-pages, so it requires no separate handling. 9 * is caught by settings-animated-pages, so it requires no separate handling.
10 */ 10 */
11 11
12 Polymer({ 12 Polymer({
13 is: 'settings-subpage', 13 is: 'settings-subpage',
14 14
15 behaviors: [ 15 behaviors: [
16 // TODO(michaelpg): phase out NeonAnimatableBehavior. 16 // TODO(michaelpg): phase out NeonAnimatableBehavior.
17 Polymer.NeonAnimatableBehavior, 17 Polymer.NeonAnimatableBehavior,
18 Polymer.IronResizableBehavior, 18 Polymer.IronResizableBehavior,
19 ], 19 ],
20 20
21 properties: { 21 properties: {
22 pageTitle: String, 22 pageTitle: String,
23
24 /** Setting a |searchLabel| will enable search. */
25 searchLabel: {
26 type: String,
27 observer: 'onSearchLabelSet_',
28 },
29
30 searchTerm: {
31 type: String,
32 notify: true,
33 value: '',
34 },
23 }, 35 },
24 36
25 /** @private */ 37 /** @private */
26 onTapBack_: function() { 38 onTapBack_: function() {
27 // Event is caught by settings-animated-pages. 39 // Event is caught by settings-animated-pages.
28 this.fire('subpage-back'); 40 this.fire('subpage-back');
29 }, 41 },
42
43 /** @private */
44 onTapClear_: function() {
45 this.$.searchInput.value = '';
46
47 // Fire events to update the UI. These are fired when the user changes the
48 // input, but not when value is set.
49 this.$.searchInput.fire('input');
50 this.$.searchInput.fire('search');
51 },
52
53 /** @private */
54 onSearchTermSearch_: function() {
55 this.searchTerm = this.$.searchInput.value;
56 },
57
58 /**
59 * @param {string} searchTerm
60 * @return {boolean}
61 */
62 hasSearchTerm_: function(searchTerm) {
63 return !!searchTerm;
64 },
65
66 /**
67 * Shows the search container when a search label is set.
68 * @param {string} searchLabel
69 */
70 onSearchLabelSet_: function(searchLabel) {
71 this.$.searchContainer.hidden = !searchLabel;
72 },
30 }); 73 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698