| 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 /** | 5 /** |
| 6 * @param {!Element} root | 6 * @param {!Element} root |
| 7 * @param {?Element} boundary | 7 * @param {?Element} boundary |
| 8 * @param {cr.ui.FocusRow.Delegate} delegate | 8 * @param {cr.ui.FocusRow.Delegate} delegate |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {cr.ui.FocusRow} | 10 * @extends {cr.ui.FocusRow} |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 lastFocused: { | 104 lastFocused: { |
| 105 type: Object, | 105 type: Object, |
| 106 notify: true, | 106 notify: true, |
| 107 }, | 107 }, |
| 108 | 108 |
| 109 ironListTabIndex: { | 109 ironListTabIndex: { |
| 110 type: Number, | 110 type: Number, |
| 111 observer: 'ironListTabIndexChanged_', | 111 observer: 'ironListTabIndexChanged_', |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 selectionNotAllowed_: { |
| 115 type: Boolean, |
| 116 value: !loadTimeData.getBoolean('allowDeletingHistory'), |
| 117 }, |
| 118 |
| 114 hasTimeGap: Boolean, | 119 hasTimeGap: Boolean, |
| 115 | 120 |
| 116 index: Number, | 121 index: Number, |
| 117 | 122 |
| 118 numberOfItems: Number, | 123 numberOfItems: Number, |
| 119 | 124 |
| 120 // The path of this history item inside its parent. | 125 // The path of this history item inside its parent. |
| 121 path: String, | 126 path: String, |
| 122 | 127 |
| 123 // Search term used to obtain this history-item. | 128 // Search term used to obtain this history-item. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 */ | 187 */ |
| 183 onItemClick_: function(e) { | 188 onItemClick_: function(e) { |
| 184 for (var i = 0; i < e.path.length; i++) { | 189 for (var i = 0; i < e.path.length; i++) { |
| 185 var elem = e.path[i]; | 190 var elem = e.path[i]; |
| 186 if (elem.id != 'checkbox' && | 191 if (elem.id != 'checkbox' && |
| 187 (elem.nodeName == 'A' || elem.nodeName == 'BUTTON')) { | 192 (elem.nodeName == 'A' || elem.nodeName == 'BUTTON')) { |
| 188 return; | 193 return; |
| 189 } | 194 } |
| 190 } | 195 } |
| 191 | 196 |
| 192 if (this.selectionNotAllowed_()) | 197 if (this.selectionNotAllowed_) |
| 193 return; | 198 return; |
| 194 | 199 |
| 195 this.$.checkbox.focus(); | 200 this.$.checkbox.focus(); |
| 196 this.fire('history-checkbox-select', { | 201 this.fire('history-checkbox-select', { |
| 197 element: this, | 202 element: this, |
| 198 shiftKey: e.shiftKey, | 203 shiftKey: e.shiftKey, |
| 199 }); | 204 }); |
| 200 }, | 205 }, |
| 201 | 206 |
| 202 /** | 207 /** |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 }, | 300 }, |
| 296 | 301 |
| 297 /** | 302 /** |
| 298 * Set the favicon image, based on the URL of the history item. | 303 * Set the favicon image, based on the URL of the history item. |
| 299 * @private | 304 * @private |
| 300 */ | 305 */ |
| 301 showIcon_: function() { | 306 showIcon_: function() { |
| 302 this.$.icon.style.backgroundImage = cr.icon.getFavicon(this.item.url); | 307 this.$.icon.style.backgroundImage = cr.icon.getFavicon(this.item.url); |
| 303 }, | 308 }, |
| 304 | 309 |
| 305 selectionNotAllowed_: function() { | |
| 306 return !loadTimeData.getBoolean('allowDeletingHistory'); | |
| 307 }, | |
| 308 | |
| 309 /** | 310 /** |
| 310 * @param {number} numberOfItems The number of items in the card. | 311 * @param {number} numberOfItems The number of items in the card. |
| 311 * @param {string} historyDate Date of the current result. | 312 * @param {string} historyDate Date of the current result. |
| 312 * @param {string} search The search term associated with these results. | 313 * @param {string} search The search term associated with these results. |
| 313 * @return {string} The title for this history card. | 314 * @return {string} The title for this history card. |
| 314 * @private | 315 * @private |
| 315 */ | 316 */ |
| 316 cardTitle_: function(numberOfItems, historyDate, search) { | 317 cardTitle_: function(numberOfItems, historyDate, search) { |
| 317 if (!search) | 318 if (!search) |
| 318 return this.item.dateRelativeDay; | 319 return this.item.dateRelativeDay; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 */ | 357 */ |
| 357 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) { | 358 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) { |
| 358 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults'; | 359 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults'; |
| 359 return loadTimeData.getStringF( | 360 return loadTimeData.getStringF( |
| 360 'foundSearchResults', numberOfResults, loadTimeData.getString(resultId), | 361 'foundSearchResults', numberOfResults, loadTimeData.getString(resultId), |
| 361 searchTerm); | 362 searchTerm); |
| 362 }; | 363 }; |
| 363 | 364 |
| 364 return {HistoryItem: HistoryItem}; | 365 return {HistoryItem: HistoryItem}; |
| 365 }); | 366 }); |
| OLD | NEW |