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

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

Issue 591353002: history: fix focus regression when showing "Remove history" confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 years, 3 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
OLDNEW
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 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 recordUmaAction('HistoryPage_InitClearBrowsingData'); 1968 recordUmaAction('HistoryPage_InitClearBrowsingData');
1969 chrome.send('clearBrowsingData'); 1969 chrome.send('clearBrowsingData');
1970 } 1970 }
1971 1971
1972 /** 1972 /**
1973 * Shows the dialog for the user to confirm removal of selected history entries. 1973 * Shows the dialog for the user to confirm removal of selected history entries.
1974 */ 1974 */
1975 function showConfirmationOverlay() { 1975 function showConfirmationOverlay() {
1976 $('alertOverlay').classList.add('showing'); 1976 $('alertOverlay').classList.add('showing');
1977 $('overlay').hidden = false; 1977 $('overlay').hidden = false;
1978 $('history-page').setAttribute('aria-hidden', 'true');
1978 uber.invokeMethodOnParent('beginInterceptingEvents'); 1979 uber.invokeMethodOnParent('beginInterceptingEvents');
1980
1981 // If an element is focused behind the confirm overlay, blur it so focus
1982 // doesn't accidentally get stuck behind it.
1983 if ($('history-page').contains(document.activeElement))
1984 document.activeElement.blur();
1979 } 1985 }
1980 1986
1981 /** 1987 /**
1982 * Hides the confirmation overlay used to confirm selected history entries. 1988 * Hides the confirmation overlay used to confirm selected history entries.
1983 */ 1989 */
1984 function hideConfirmationOverlay() { 1990 function hideConfirmationOverlay() {
1985 $('alertOverlay').classList.remove('showing'); 1991 $('alertOverlay').classList.remove('showing');
1986 $('overlay').hidden = true; 1992 $('overlay').hidden = true;
1993 $('history-page').removeAttribute('aria-hidden');
1987 uber.invokeMethodOnParent('stopInterceptingEvents'); 1994 uber.invokeMethodOnParent('stopInterceptingEvents');
1988 } 1995 }
1989 1996
1990 /** 1997 /**
1991 * Shows the confirmation alert for history deletions and permits browser tests 1998 * Shows the confirmation alert for history deletions and permits browser tests
1992 * to override the dialog. 1999 * to override the dialog.
1993 * @param {function()=} okCallback A function to be called when the user presses 2000 * @param {function()=} okCallback A function to be called when the user presses
1994 * the ok button. 2001 * the ok button.
1995 * @param {function()=} cancelCallback A function to be called when the user 2002 * @param {function()=} cancelCallback A function to be called when the user
1996 * presses the cancel button. 2003 * presses the cancel button.
1997 */ 2004 */
1998 function confirmDeletion(okCallback, cancelCallback) { 2005 function confirmDeletion(okCallback, cancelCallback) {
1999 alertOverlay.setValues( 2006 alertOverlay.setValues(
2000 loadTimeData.getString('removeSelected'), 2007 loadTimeData.getString('removeSelected'),
2001 loadTimeData.getString('deleteWarning'), 2008 loadTimeData.getString('deleteWarning'),
2009 loadTimeData.getString('deleteConfirm'),
2002 loadTimeData.getString('cancel'), 2010 loadTimeData.getString('cancel'),
2003 loadTimeData.getString('deleteConfirm'), 2011 okCallback,
2004 cancelCallback, 2012 cancelCallback);
2005 okCallback);
2006 showConfirmationOverlay(); 2013 showConfirmationOverlay();
2007 } 2014 }
2008 2015
2009 /** 2016 /**
2010 * Click handler for the 'Remove selected items' button. 2017 * Click handler for the 'Remove selected items' button.
2011 * Confirms the deletion with the user, and then deletes the selected visits. 2018 * Confirms the deletion with the user, and then deletes the selected visits.
2012 */ 2019 */
2013 function removeItems() { 2020 function removeItems() {
2014 recordUmaAction('HistoryPage_RemoveSelected'); 2021 recordUmaAction('HistoryPage_RemoveSelected');
2015 if (!loadTimeData.getBoolean('allowDeletingHistory')) 2022 if (!loadTimeData.getBoolean('allowDeletingHistory'))
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 historyView.reload(); 2273 historyView.reload();
2267 } 2274 }
2268 2275
2269 // Add handlers to HTML elements. 2276 // Add handlers to HTML elements.
2270 document.addEventListener('DOMContentLoaded', load); 2277 document.addEventListener('DOMContentLoaded', load);
2271 2278
2272 // This event lets us enable and disable menu items before the menu is shown. 2279 // This event lets us enable and disable menu items before the menu is shown.
2273 document.addEventListener('canExecute', function(e) { 2280 document.addEventListener('canExecute', function(e) {
2274 e.canExecute = true; 2281 e.canExecute = true;
2275 }); 2282 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/history/alert_overlay.html ('k') | chrome/test/data/webui/history_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698