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

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

Issue 2388413002: MD History: Announce search results for screen-reader users (Closed)
Patch Set: Address nits 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..e064ec6710efbb08bdb2ce0cd7a0d3f1e39c6ef5 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} numberOfResults
+ * @param {string} searchTerm
+ * @return {string} The title for a page of search results.
+ */
+ HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) {
+ var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults';
+ return loadTimeData.getStringF('foundSearchResults', numberOfResults,
+ loadTimeData.getString(resultId), searchTerm);
+ };
+
return { HistoryItem: HistoryItem };
});
« no previous file with comments | « chrome/browser/resources/md_history/app.crisper.js ('k') | chrome/browser/resources/md_history/list_container.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698