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

Unified Diff: chrome/browser/resources/md_history/history_item.js

Issue 2388413002: MD History: Announce search results for screen-reader users (Closed)
Patch Set: announceAccessibleMessage Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/history_item.js
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js
index e312a796c19541d489a2b396674397eb7ae03913..0e7bafc48cd947f754a044d76fd4fac7309d621d 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -289,18 +289,16 @@ cr.define('md_history', function() {
},
/**
- * Generates the title for this history card.
* @param {number} numberOfItems The number of items in the card.
+ * @param {string} historyDate Date of the current result.
* @param {string} search The search term associated with these results.
+ * @return {string} The title for this history card.
* @private
*/
cardTitle_: function(numberOfItems, historyDate, search) {
if (!search)
return this.item.dateRelativeDay;
-
- var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults';
- return loadTimeData.getStringF('foundSearchResults', numberOfItems,
- loadTimeData.getString(resultId), search);
+ return HistoryItem.searchResultsTitle(numberOfItems, search);
},
});
@@ -311,7 +309,6 @@ cr.define('md_history', function() {
* @param {number} currentIndex
* @param {string} searchedTerm
* @return {boolean} Whether or not time gap separator is required.
- * @private
*/
HistoryItem.needsTimeGap = function(visits, currentIndex, searchedTerm) {
if (currentIndex >= visits.length - 1 || visits.length == 0)
@@ -327,5 +324,16 @@ cr.define('md_history', function() {
currentItem.dateRelativeDay == nextItem.dateRelativeDay;
};
+ /**
+ * @param {number} numberOfItems
Dan Beam 2016/10/05 01:34:48 nit: numberOfResults
tsergeant 2016/10/05 01:57:32 Done.
+ * @param {string} search
Dan Beam 2016/10/05 01:34:48 nit: searchTerm
tsergeant 2016/10/05 01:57:32 Done.
+ * @return {string} The title for a page of search results.
+ */
+ HistoryItem.searchResultsTitle = function(numberOfItems, search) {
+ var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults';
+ return loadTimeData.getStringF('foundSearchResults', numberOfItems,
+ loadTimeData.getString(resultId), search);
+ };
+
return { HistoryItem: HistoryItem };
});

Powered by Google App Engine
This is Rietveld 408576698