Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: chrome/browser/resources/history.js

Issue 7086030: Refresh the history page if history entries get deleted, except for when currently editing entries (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/history2.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Globals: 6 // Globals:
7 var RESULTS_PER_PAGE = 150; 7 var RESULTS_PER_PAGE = 150;
8 var MAX_SEARCH_DEPTH_MONTHS = 18; 8 var MAX_SEARCH_DEPTH_MONTHS = 18;
9 9
10 // Amount of time between pageviews that we consider a 'break' in browsing, 10 // Amount of time between pageviews that we consider a 'break' in browsing,
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 /** 505 /**
506 * Toggles the edit mode and triggers UI update. 506 * Toggles the edit mode and triggers UI update.
507 */ 507 */
508 HistoryView.prototype.toggleEditMode = function() { 508 HistoryView.prototype.toggleEditMode = function() {
509 var editMode = !this.model_.getEditMode(); 509 var editMode = !this.model_.getEditMode();
510 this.setEditMode(editMode); 510 this.setEditMode(editMode);
511 this.updateEditControls_(); 511 this.updateEditControls_();
512 }; 512 };
513 513
514 /** 514 /**
515 * @return {boolean} Whether we are in edit mode where history items can be
516 * deleted
517 */
518 HistoryView.prototype.getEditMode = function() {
519 return this.model_.getEditMode();
520 };
521
522 /**
515 * Reload the current view. 523 * Reload the current view.
516 */ 524 */
517 HistoryView.prototype.reload = function() { 525 HistoryView.prototype.reload = function() {
518 this.model_.reload(); 526 this.model_.reload();
519 }; 527 };
520 528
521 /** 529 /**
522 * Switch to a specified page. 530 * Switch to a specified page.
523 * @param {number} page The page we wish to view. 531 * @param {number} page The page we wish to view.
524 */ 532 */
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 * Our history system calls this function when a deletion has finished. 1023 * Our history system calls this function when a deletion has finished.
1016 */ 1024 */
1017 function deleteComplete() { 1025 function deleteComplete() {
1018 window.console.log('Delete complete'); 1026 window.console.log('Delete complete');
1019 deleteInFlight = false; 1027 deleteInFlight = false;
1020 if (deleteQueue.length > 2) { 1028 if (deleteQueue.length > 2) {
1021 deleteQueue = deleteQueue.slice(2); 1029 deleteQueue = deleteQueue.slice(2);
1022 deleteNextInQueue(); 1030 deleteNextInQueue();
1023 } else { 1031 } else {
1024 deleteQueue = []; 1032 deleteQueue = [];
1025 historyView.reload();
1026 } 1033 }
1027 } 1034 }
1028 1035
1029 /** 1036 /**
1030 * Our history system calls this function if a delete is not ready (e.g. 1037 * Our history system calls this function if a delete is not ready (e.g.
1031 * another delete is in-progress). 1038 * another delete is in-progress).
1032 */ 1039 */
1033 function deleteFailed() { 1040 function deleteFailed() {
1034 window.console.log('Delete failed'); 1041 window.console.log('Delete failed');
1035 // The deletion failed - try again later. 1042 // The deletion failed - try again later.
1036 deleteInFlight = false; 1043 deleteInFlight = false;
1037 setTimeout(deleteNextInQueue, 500); 1044 setTimeout(deleteNextInQueue, 500);
1038 } 1045 }
1039 1046
1047 /**
1048 * We're called when something is deleted (either by us or by someone
1049 * else).
1050 */
1051 function historyDeleted() {
1052 window.console.log('History deleted');
1053 var anyChecked = document.querySelector('.entry input:checked') != null;
1054 if (!(historyView.getEditMode() && anyChecked))
1055 historyView.reload();
1056 }
1057
1040 // Add handlers to HTML elements. 1058 // Add handlers to HTML elements.
1041 document.body.onload = load; 1059 document.body.onload = load;
1042 $('history-section').onclick = function () { 1060 $('history-section').onclick = function () {
1043 setSearch(''); 1061 setSearch('');
1044 return false; 1062 return false;
1045 }; 1063 };
1046 $('search-form').onsubmit = function () { 1064 $('search-form').onsubmit = function () {
1047 setSearch(this.term.value); 1065 setSearch(this.term.value);
1048 return false; 1066 return false;
1049 } 1067 }
1050 1068
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/history2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698