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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 historyView.setSearch(this.domain_); | 482 historyView.setSearch(this.domain_); |
483 $('search-field').focus(); | 483 $('search-field').focus(); |
484 }; | 484 }; |
485 | 485 |
486 /** | 486 /** |
487 * @param {Event} e A keydown event to handle. | 487 * @param {Event} e A keydown event to handle. |
488 * @private | 488 * @private |
489 */ | 489 */ |
490 Visit.prototype.handleKeydown_ = function(e) { | 490 Visit.prototype.handleKeydown_ = function(e) { |
491 // Delete or Backspace should delete the entry if allowed. | 491 // Delete or Backspace should delete the entry if allowed. |
492 if ((e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F') && | 492 if (e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F') |
493 !this.model_.isDeletingVisits()) { | |
494 this.removeEntryFromHistory_(e); | 493 this.removeEntryFromHistory_(e); |
495 } | |
496 }; | 494 }; |
497 | 495 |
498 /** | 496 /** |
499 * Removes a history entry on click or keydown and finds a new entry to focus. | 497 * Removes a history entry on click or keydown and finds a new entry to focus. |
500 * @param {Event} e A click or keydown event. | 498 * @param {Event} e A click or keydown event. |
501 * @private | 499 * @private |
502 */ | 500 */ |
503 Visit.prototype.removeEntryFromHistory_ = function(e) { | 501 Visit.prototype.removeEntryFromHistory_ = function(e) { |
504 if (!this.model_.deletingHistoryAllowed) | 502 if (!this.model_.deletingHistoryAllowed || this.model_.isDeletingVisits() || |
| 503 this.domNode_.classList.contains('fade-out')) { |
505 return; | 504 return; |
| 505 } |
506 | 506 |
507 this.model_.getView().onBeforeRemove(this); | 507 this.model_.getView().onBeforeRemove(this); |
508 this.removeFromHistory(); | 508 this.removeFromHistory(); |
509 e.preventDefault(); | 509 e.preventDefault(); |
510 }; | 510 }; |
511 | 511 |
512 // Visit, private, static: ---------------------------------------------------- | 512 // Visit, private, static: ---------------------------------------------------- |
513 | 513 |
514 /** | 514 /** |
515 * Quote a string so it can be used in a regular expression. | 515 * Quote a string so it can be used in a regular expression. |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 }; | 1218 }; |
1219 | 1219 |
1220 /** | 1220 /** |
1221 * Called when an individual history entry has been removed from the page. | 1221 * Called when an individual history entry has been removed from the page. |
1222 * This will only be called when all the elements affected by the deletion | 1222 * This will only be called when all the elements affected by the deletion |
1223 * have been removed from the DOM and the animations have completed. | 1223 * have been removed from the DOM and the animations have completed. |
1224 */ | 1224 */ |
1225 HistoryView.prototype.onEntryRemoved = function() { | 1225 HistoryView.prototype.onEntryRemoved = function() { |
1226 this.updateSelectionEditButtons(); | 1226 this.updateSelectionEditButtons(); |
1227 | 1227 |
1228 if (this.model_.getSize() == 0) | 1228 if (this.model_.getSize() == 0) { |
| 1229 this.clear_(); |
1229 this.onModelReady(true); // Shows "No entries" message. | 1230 this.onModelReady(true); // Shows "No entries" message. |
| 1231 } |
1230 }; | 1232 }; |
1231 | 1233 |
1232 /** | 1234 /** |
1233 * Adjusts the position of the notification bar based on the size of the page. | 1235 * Adjusts the position of the notification bar based on the size of the page. |
1234 */ | 1236 */ |
1235 HistoryView.prototype.positionNotificationBar = function() { | 1237 HistoryView.prototype.positionNotificationBar = function() { |
1236 var bar = $('notification-bar'); | 1238 var bar = $('notification-bar'); |
1237 | 1239 |
1238 // If the bar does not fit beside the editing controls, put it into the | 1240 // If the bar does not fit beside the editing controls, put it into the |
1239 // overflow state. | 1241 // overflow state. |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 historyView.reload(); | 2277 historyView.reload(); |
2276 } | 2278 } |
2277 | 2279 |
2278 // Add handlers to HTML elements. | 2280 // Add handlers to HTML elements. |
2279 document.addEventListener('DOMContentLoaded', load); | 2281 document.addEventListener('DOMContentLoaded', load); |
2280 | 2282 |
2281 // This event lets us enable and disable menu items before the menu is shown. | 2283 // This event lets us enable and disable menu items before the menu is shown. |
2282 document.addEventListener('canExecute', function(e) { | 2284 document.addEventListener('canExecute', function(e) { |
2283 e.canExecute = true; | 2285 e.canExecute = true; |
2284 }); | 2286 }); |
OLD | NEW |