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 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
| 1979 // If an element is focused behind the confirm overlay, blur it so focus |
| 1980 // doesn't accidentally get stuck behind it. |
| 1981 if ($('history-page').contains(document.activeElement)) |
| 1982 document.activeElement.blur(); |
| 1983 |
| 1984 $('history-page').setAttribute('aria-hidden', 'true'); |
| 1985 |
1978 uber.invokeMethodOnParent('beginInterceptingEvents'); | 1986 uber.invokeMethodOnParent('beginInterceptingEvents'); |
1979 } | 1987 } |
1980 | 1988 |
1981 /** | 1989 /** |
1982 * Hides the confirmation overlay used to confirm selected history entries. | 1990 * Hides the confirmation overlay used to confirm selected history entries. |
1983 */ | 1991 */ |
1984 function hideConfirmationOverlay() { | 1992 function hideConfirmationOverlay() { |
1985 $('alertOverlay').classList.remove('showing'); | 1993 $('alertOverlay').classList.remove('showing'); |
1986 $('overlay').hidden = true; | 1994 $('overlay').hidden = true; |
| 1995 $('history-page').removeAttribute('aria-hidden'); |
1987 uber.invokeMethodOnParent('stopInterceptingEvents'); | 1996 uber.invokeMethodOnParent('stopInterceptingEvents'); |
1988 } | 1997 } |
1989 | 1998 |
1990 /** | 1999 /** |
1991 * Shows the confirmation alert for history deletions and permits browser tests | 2000 * Shows the confirmation alert for history deletions and permits browser tests |
1992 * to override the dialog. | 2001 * to override the dialog. |
1993 * @param {function()=} okCallback A function to be called when the user presses | 2002 * @param {function()=} okCallback A function to be called when the user presses |
1994 * the ok button. | 2003 * the ok button. |
1995 * @param {function()=} cancelCallback A function to be called when the user | 2004 * @param {function()=} cancelCallback A function to be called when the user |
1996 * presses the cancel button. | 2005 * presses the cancel button. |
1997 */ | 2006 */ |
1998 function confirmDeletion(okCallback, cancelCallback) { | 2007 function confirmDeletion(okCallback, cancelCallback) { |
1999 alertOverlay.setValues( | 2008 alertOverlay.setValues( |
2000 loadTimeData.getString('removeSelected'), | 2009 loadTimeData.getString('removeSelected'), |
2001 loadTimeData.getString('deleteWarning'), | 2010 loadTimeData.getString('deleteWarning'), |
| 2011 loadTimeData.getString('deleteConfirm'), |
2002 loadTimeData.getString('cancel'), | 2012 loadTimeData.getString('cancel'), |
2003 loadTimeData.getString('deleteConfirm'), | 2013 okCallback, |
2004 cancelCallback, | 2014 cancelCallback); |
2005 okCallback); | |
2006 showConfirmationOverlay(); | 2015 showConfirmationOverlay(); |
2007 } | 2016 } |
2008 | 2017 |
2009 /** | 2018 /** |
2010 * Click handler for the 'Remove selected items' button. | 2019 * Click handler for the 'Remove selected items' button. |
2011 * Confirms the deletion with the user, and then deletes the selected visits. | 2020 * Confirms the deletion with the user, and then deletes the selected visits. |
2012 */ | 2021 */ |
2013 function removeItems() { | 2022 function removeItems() { |
2014 recordUmaAction('HistoryPage_RemoveSelected'); | 2023 recordUmaAction('HistoryPage_RemoveSelected'); |
2015 if (!loadTimeData.getBoolean('allowDeletingHistory')) | 2024 if (!loadTimeData.getBoolean('allowDeletingHistory')) |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 historyView.reload(); | 2275 historyView.reload(); |
2267 } | 2276 } |
2268 | 2277 |
2269 // Add handlers to HTML elements. | 2278 // Add handlers to HTML elements. |
2270 document.addEventListener('DOMContentLoaded', load); | 2279 document.addEventListener('DOMContentLoaded', load); |
2271 | 2280 |
2272 // This event lets us enable and disable menu items before the menu is shown. | 2281 // This event lets us enable and disable menu items before the menu is shown. |
2273 document.addEventListener('canExecute', function(e) { | 2282 document.addEventListener('canExecute', function(e) { |
2274 e.canExecute = true; | 2283 e.canExecute = true; |
2275 }); | 2284 }); |
OLD | NEW |