OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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: 'history-toolbar', | 6 is: 'history-toolbar', |
7 properties: { | 7 properties: { |
8 // Number of history items currently selected. | 8 // Number of history items currently selected. |
9 // TODO(calamity): bind this to | 9 // TODO(calamity): bind this to |
10 // listContainer.selectedItem.selectedPaths.length. | 10 // listContainer.selectedItem.selectedPaths.length. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 value: 0, | 54 value: 0, |
55 reflectToAttribute: true, | 55 reflectToAttribute: true, |
56 notify: true | 56 notify: true |
57 }, | 57 }, |
58 | 58 |
59 // The start time of the query range. | 59 // The start time of the query range. |
60 queryStartTime: String, | 60 queryStartTime: String, |
61 | 61 |
62 // The end time of the query range. | 62 // The end time of the query range. |
63 queryEndTime: String, | 63 queryEndTime: String, |
64 | |
65 // Whether to show the menu promo (a tooltip that points at the menu button | |
66 // in narrow mode). | |
67 showMenuPromo_: { | |
68 type: Boolean, | |
69 value: function() { | |
70 return loadTimeData.getBoolean('showMenuPromo'); | |
71 }, | |
72 }, | |
64 }, | 73 }, |
65 | 74 |
66 /** | 75 /** |
67 * Changes the toolbar background color depending on whether any history items | 76 * Changes the toolbar background color depending on whether any history items |
68 * are currently selected. | 77 * are currently selected. |
69 * @private | 78 * @private |
70 */ | 79 */ |
71 changeToolbarView_: function() { | 80 changeToolbarView_: function() { |
72 this.itemsSelected_ = this.count > 0; | 81 this.itemsSelected_ = this.count > 0; |
73 }, | 82 }, |
74 | 83 |
75 /** | 84 /** |
76 * When changing the search term externally, update the search field to | 85 * When changing the search term externally, update the search field to |
77 * reflect the new search term. | 86 * reflect the new search term. |
78 * @param {string} search | 87 * @param {string} search |
79 */ | 88 */ |
80 setSearchTerm: function(search) { | 89 setSearchTerm: function(search) { |
81 if (this.searchTerm == search) | 90 if (this.searchTerm == search) |
82 return; | 91 return; |
83 | 92 |
84 this.searchTerm = search; | 93 this.searchTerm = search; |
85 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) | 94 var searchField = /** @type {!CrToolbarElement} */(this.$['main-toolbar']) |
86 .getSearchField(); | 95 .getSearchField(); |
87 searchField.showAndFocus(); | 96 searchField.showAndFocus(); |
88 searchField.setValue(search); | 97 searchField.setValue(search); |
89 }, | 98 }, |
90 | 99 |
100 /** @private */ | |
101 onMenuPromoShown_: function() { | |
102 this.showMenuPromo_ = false; | |
103 md_history.BrowserService.getInstance().menuPromoShown(); | |
tsergeant
2016/08/25 04:51:00
Looks like you'll need to add browser_service as a
Dan Beam
2016/09/09 03:12:08
Done.
| |
104 }, | |
105 | |
91 /** | 106 /** |
92 * @param {!CustomEvent} event | 107 * @param {!CustomEvent} event |
93 * @private | 108 * @private |
94 */ | 109 */ |
95 onSearchChanged_: function(event) { | 110 onSearchChanged_: function(event) { |
96 this.searchTerm = /** @type {string} */ (event.detail); | 111 this.searchTerm = /** @type {string} */ (event.detail); |
97 }, | 112 }, |
98 | 113 |
99 onClearSelectionTap_: function() { | 114 onClearSelectionTap_: function() { |
100 this.fire('unselect-all'); | 115 this.fire('unselect-all'); |
(...skipping 29 matching lines...) Expand all Loading... | |
130 // TODO(calamity): Fix the format of these dates. | 145 // TODO(calamity): Fix the format of these dates. |
131 return loadTimeData.getStringF( | 146 return loadTimeData.getStringF( |
132 'historyInterval', queryStartTime, queryEndTime); | 147 'historyInterval', queryStartTime, queryEndTime); |
133 }, | 148 }, |
134 | 149 |
135 /** @private */ | 150 /** @private */ |
136 hasDrawerChanged_: function() { | 151 hasDrawerChanged_: function() { |
137 this.updateStyles(); | 152 this.updateStyles(); |
138 }, | 153 }, |
139 }); | 154 }); |
OLD | NEW |