OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <include src="../uber/uber_utils.js"> | 5 <include src="../uber/uber_utils.js"> |
6 <include src="history_focus_manager.js"> | 6 <include src="history_focus_manager.js"> |
7 | 7 |
8 /////////////////////////////////////////////////////////////////////////////// | 8 /////////////////////////////////////////////////////////////////////////////// |
9 // Globals: | 9 // Globals: |
10 /** @const */ var RESULTS_PER_PAGE = 150; | 10 /** @const */ var RESULTS_PER_PAGE = 150; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 Visit.prototype.getResultDOM = function(propertyBag) { | 180 Visit.prototype.getResultDOM = function(propertyBag) { |
181 var isSearchResult = propertyBag.isSearchResult || false; | 181 var isSearchResult = propertyBag.isSearchResult || false; |
182 var addTitleFavicon = propertyBag.addTitleFavicon || false; | 182 var addTitleFavicon = propertyBag.addTitleFavicon || false; |
183 var useMonthDate = propertyBag.useMonthDate || false; | 183 var useMonthDate = propertyBag.useMonthDate || false; |
184 var focusless = propertyBag.focusless || false; | 184 var focusless = propertyBag.focusless || false; |
185 var node = createElementWithClassName('li', 'entry'); | 185 var node = createElementWithClassName('li', 'entry'); |
186 var time = createElementWithClassName('span', 'time'); | 186 var time = createElementWithClassName('span', 'time'); |
187 var entryBox = createElementWithClassName('div', 'entry-box'); | 187 var entryBox = createElementWithClassName('div', 'entry-box'); |
188 var domain = createElementWithClassName('div', 'domain'); | 188 var domain = createElementWithClassName('div', 'domain'); |
189 | 189 |
190 this.id_ = this.model_.nextVisitId_++; | 190 this.id_ = this.model_.getNextVisitId(); |
191 var self = this; | 191 var self = this; |
192 | 192 |
193 // Only create the checkbox if it can be used either to delete an entry or to | 193 // Only create the checkbox if it can be used either to delete an entry or to |
194 // block/allow it. | 194 // block/allow it. |
195 if (this.model_.editingEntriesAllowed) { | 195 if (this.model_.editingEntriesAllowed) { |
196 var checkbox = document.createElement('input'); | 196 var checkbox = document.createElement('input'); |
197 checkbox.type = 'checkbox'; | 197 checkbox.type = 'checkbox'; |
198 checkbox.id = 'checkbox-' + this.id_; | 198 checkbox.id = 'checkbox-' + this.id_; |
199 checkbox.setAttribute('aria-label', | |
200 loadTimeData.getString('removeFromHistory')); | |
201 checkbox.time = this.date.getTime(); | 199 checkbox.time = this.date.getTime(); |
200 | |
201 var summaryFields = [this.dateTimeOfDay, this.title_, this.domain_]; | |
202 checkbox.setAttribute('aria-label', summaryFields.join('\n')); | |
dmazzoni
2014/10/21 05:11:33
Maybe join with comma and space? This will get ren
Dan Beam
2014/10/21 05:14:03
This was the only way that I thought would have a
| |
203 | |
202 checkbox.addEventListener('click', checkboxClicked); | 204 checkbox.addEventListener('click', checkboxClicked); |
203 entryBox.appendChild(checkbox); | 205 entryBox.appendChild(checkbox); |
204 | 206 |
205 if (focusless) | 207 if (focusless) |
206 checkbox.tabIndex = -1; | 208 checkbox.tabIndex = -1; |
207 | 209 |
208 if (!isMobileVersion()) { | 210 if (!isMobileVersion()) { |
209 // Clicking anywhere in the entryBox will check/uncheck the checkbox. | 211 // Clicking anywhere in the entryBox will check/uncheck the checkbox. |
210 entryBox.setAttribute('for', checkbox.id); | 212 entryBox.setAttribute('for', checkbox.id); |
211 entryBox.addEventListener('mousedown', entryBoxMousedown); | 213 entryBox.addEventListener('mousedown', entryBoxMousedown); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 /** | 738 /** |
737 * Removes |visit| from this model. | 739 * Removes |visit| from this model. |
738 * @param {Visit} visit A visit to remove. | 740 * @param {Visit} visit A visit to remove. |
739 */ | 741 */ |
740 HistoryModel.prototype.removeVisit = function(visit) { | 742 HistoryModel.prototype.removeVisit = function(visit) { |
741 var index = this.visits_.indexOf(visit); | 743 var index = this.visits_.indexOf(visit); |
742 if (index >= 0) | 744 if (index >= 0) |
743 this.visits_.splice(index, 1); | 745 this.visits_.splice(index, 1); |
744 }; | 746 }; |
745 | 747 |
748 /** | |
749 * Automatically generates a new visit ID. | |
750 * @return {number} The next visit ID. | |
751 */ | |
752 HistoryModel.prototype.getNextVisitId = function() { | |
753 return this.nextVisitId_++; | |
754 }; | |
755 | |
746 // HistoryModel, Private: ----------------------------------------------------- | 756 // HistoryModel, Private: ----------------------------------------------------- |
747 | 757 |
748 /** | 758 /** |
749 * Clear the history model. | 759 * Clear the history model. |
750 * @private | 760 * @private |
751 */ | 761 */ |
752 HistoryModel.prototype.clearModel_ = function() { | 762 HistoryModel.prototype.clearModel_ = function() { |
753 this.inFlight_ = false; // Whether a query is inflight. | 763 this.inFlight_ = false; // Whether a query is inflight. |
754 this.searchText_ = ''; | 764 this.searchText_ = ''; |
755 // Whether this user is a supervised user. | 765 // Whether this user is a supervised user. |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2272 historyView.reload(); | 2282 historyView.reload(); |
2273 } | 2283 } |
2274 | 2284 |
2275 // Add handlers to HTML elements. | 2285 // Add handlers to HTML elements. |
2276 document.addEventListener('DOMContentLoaded', load); | 2286 document.addEventListener('DOMContentLoaded', load); |
2277 | 2287 |
2278 // This event lets us enable and disable menu items before the menu is shown. | 2288 // This event lets us enable and disable menu items before the menu is shown. |
2279 document.addEventListener('canExecute', function(e) { | 2289 document.addEventListener('canExecute', function(e) { |
2280 e.canExecute = true; | 2290 e.canExecute = true; |
2281 }); | 2291 }); |
OLD | NEW |