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 behaviors: [ | 8 behaviors: [ |
9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
10 ], | 10 ], |
11 | 11 |
12 properties: { | 12 properties: { |
13 /** @private */ | 13 /** @private */ |
14 searchTerm_: { | 14 searchTerm_: { |
15 type: String, | 15 type: String, |
16 observer: 'onSearchTermChanged_', | 16 observer: 'onSearchTermChanged_', |
17 }, | 17 }, |
| 18 |
| 19 sidebarWidth: { |
| 20 type: String, |
| 21 observer: 'onSidebarWidthChanged_', |
| 22 }, |
18 }, | 23 }, |
19 | 24 |
20 attached: function() { | 25 attached: function() { |
21 this.watch('searchTerm_', function(state) { | 26 this.watch('searchTerm_', function(state) { |
22 return state.search.term; | 27 return state.search.term; |
23 }); | 28 }); |
24 }, | 29 }, |
25 | 30 |
26 /** @return {CrToolbarSearchFieldElement} */ | 31 /** @return {CrToolbarSearchFieldElement} */ |
27 get searchField() { | 32 get searchField() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 78 |
74 /** | 79 /** |
75 * @param {Event} e | 80 * @param {Event} e |
76 * @private | 81 * @private |
77 */ | 82 */ |
78 onSearchChanged_: function(e) { | 83 onSearchChanged_: function(e) { |
79 var searchTerm = /** @type {string} */ (e.detail); | 84 var searchTerm = /** @type {string} */ (e.detail); |
80 this.dispatch(bookmarks.actions.setSearchTerm(searchTerm)); | 85 this.dispatch(bookmarks.actions.setSearchTerm(searchTerm)); |
81 }, | 86 }, |
82 | 87 |
| 88 onSidebarWidthChanged_: function() { |
| 89 this.style.setProperty('--sidebar-width', this.sidebarWidth); |
| 90 }, |
| 91 |
83 /** @private */ | 92 /** @private */ |
84 onSearchTermChanged_: function() { | 93 onSearchTermChanged_: function() { |
85 this.searchField.setValue(this.searchTerm_ || ''); | 94 this.searchField.setValue(this.searchTerm_ || ''); |
86 }, | 95 }, |
87 }); | 96 }); |
OLD | NEW |