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 Polymer({ | 5 Polymer({ |
6 is: 'bookmarks-toolbar', | 6 is: 'bookmarks-toolbar', |
7 | 7 |
8 properties: { | 8 properties: { |
9 searchTerm: { | 9 searchTerm: { |
10 type: String, | 10 type: String, |
11 observer: 'onSearchTermChanged_', | 11 observer: 'onSearchTermChanged_', |
12 }, | 12 }, |
| 13 |
| 14 sidebarWidth: { |
| 15 type: String, |
| 16 observer: 'onSidebarWidthChanged_', |
| 17 }, |
13 }, | 18 }, |
14 | 19 |
15 /** @return {CrToolbarSearchFieldElement} */ | 20 /** @return {CrToolbarSearchFieldElement} */ |
16 get searchField() { | 21 get searchField() { |
17 return /** @type {CrToolbarElement} */ (this.$$('cr-toolbar')) | 22 return /** @type {CrToolbarElement} */ (this.$$('cr-toolbar')) |
18 .getSearchField(); | 23 .getSearchField(); |
19 }, | 24 }, |
20 | 25 |
21 /** | 26 /** |
22 * @param {Event} e | 27 * @param {Event} e |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 67 |
63 /** | 68 /** |
64 * @param {Event} e | 69 * @param {Event} e |
65 * @private | 70 * @private |
66 */ | 71 */ |
67 onSearchChanged_: function(e) { | 72 onSearchChanged_: function(e) { |
68 var searchTerm = /** @type {string} */ (e.detail); | 73 var searchTerm = /** @type {string} */ (e.detail); |
69 this.fire('search-term-changed', searchTerm); | 74 this.fire('search-term-changed', searchTerm); |
70 }, | 75 }, |
71 | 76 |
| 77 onSidebarWidthChanged_: function() { |
| 78 this.style.setProperty('--sidebar-width', this.sidebarWidth); |
| 79 }, |
| 80 |
72 /** @private */ | 81 /** @private */ |
73 onSearchTermChanged_: function() { | 82 onSearchTermChanged_: function() { |
74 this.searchField.setValue(this.searchTerm || ''); | 83 this.searchField.setValue(this.searchTerm || ''); |
75 }, | 84 }, |
76 }); | 85 }); |
OLD | NEW |