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: 'history-app', | 6 is: 'history-app', |
7 | 7 |
8 properties: { | 8 properties: { |
9 // The id of the currently selected page. | 9 // The id of the currently selected page. |
10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, | 10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, |
(...skipping 26 matching lines...) Expand all Loading... | |
37 queryResult_: { | 37 queryResult_: { |
38 type: Object, | 38 type: Object, |
39 value: function() { | 39 value: function() { |
40 return { | 40 return { |
41 info: null, | 41 info: null, |
42 results: null, | 42 results: null, |
43 sessionList: null, | 43 sessionList: null, |
44 }; | 44 }; |
45 } | 45 } |
46 }, | 46 }, |
47 | |
48 // Route data for the current page. | |
49 routeData_: Object, | |
47 }, | 50 }, |
48 | 51 |
52 observers: [ | |
53 // routeData_.page <=> selectedPage | |
54 'routeDataChanged_(routeData_.page)', | |
55 'selectedPageChanged_(selectedPage_)', | |
56 ], | |
57 | |
58 // TODO(calamity): Replace these event listeners with data bound properties. | |
49 listeners: { | 59 listeners: { |
50 'cr-menu-tap': 'onMenuTap_', | 60 'cr-menu-tap': 'onMenuTap_', |
51 'history-checkbox-select': 'checkboxSelected', | 61 'history-checkbox-select': 'checkboxSelected', |
52 'unselect-all': 'unselectAll', | 62 'unselect-all': 'unselectAll', |
53 'delete-selected': 'deleteSelected', | 63 'delete-selected': 'deleteSelected', |
54 'search-domain': 'searchDomain_', | 64 'search-domain': 'searchDomain_', |
55 }, | 65 }, |
56 | 66 |
57 /** @override */ | 67 /** @override */ |
58 ready: function() { | 68 ready: function() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 .$$('history-synced-device-manager'); | 162 .$$('history-synced-device-manager'); |
153 syncedDeviceManagerElem.updateSignInState(isUserSignedIn); | 163 syncedDeviceManagerElem.updateSignInState(isUserSignedIn); |
154 }, | 164 }, |
155 | 165 |
156 /** | 166 /** |
157 * @param {string} selectedPage | 167 * @param {string} selectedPage |
158 * @return {boolean} | 168 * @return {boolean} |
159 * @private | 169 * @private |
160 */ | 170 */ |
161 syncedTabsSelected_: function(selectedPage) { | 171 syncedTabsSelected_: function(selectedPage) { |
162 return selectedPage == 'synced-devices'; | 172 return selectedPage == 'syncedTabs'; |
163 }, | 173 }, |
164 | 174 |
165 /** | 175 /** |
166 * @param {boolean} querying | 176 * @param {boolean} querying |
167 * @param {boolean} incremental | 177 * @param {boolean} incremental |
168 * @param {string} searchTerm | 178 * @param {string} searchTerm |
169 * @return {boolean} Whether a loading spinner should be shown (implies the | 179 * @return {boolean} Whether a loading spinner should be shown (implies the |
170 * backend is querying a new search term). | 180 * backend is querying a new search term). |
171 * @private | 181 * @private |
172 */ | 182 */ |
173 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 183 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
174 return querying && !incremental && searchTerm != ''; | 184 return querying && !incremental && searchTerm != ''; |
175 }, | 185 }, |
186 | |
187 /** | |
188 * @param {string} page | |
189 * @private | |
190 */ | |
191 routeDataChanged_: function(page) { | |
192 this.selectedPage_ = page; | |
193 }, | |
194 | |
195 /** | |
196 * @param {string} selectedPage | |
197 * @private | |
198 */ | |
199 selectedPageChanged_: function(selectedPage) { | |
200 this.set('routeData_.page', selectedPage); | |
201 }, | |
202 | |
203 /** | |
204 * @param {string} selectedPage | |
205 * @param {Array} items | |
206 * @return {string} | |
207 * @private | |
208 */ | |
209 getSelectedPage_(selectedPage, items) { | |
tsergeant
2016/07/13 07:23:33
If I understand correctly, this only exists to for
calamity
2016/07/14 06:20:57
Good point. Done.
| |
210 return selectedPage; | |
211 }, | |
176 }); | 212 }); |
OLD | NEW |