Index: chrome/browser/resources/history/history.js |
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js |
index e67c903fbf9048662f3d37d619b4fd9ce0e6bcf9..a4cb64b875827142e08ccc27c41928adea83242d 100644 |
--- a/chrome/browser/resources/history/history.js |
+++ b/chrome/browser/resources/history/history.js |
@@ -644,12 +644,6 @@ HistoryModel.prototype.addResults = function(info, results) { |
lastDay = thisDay; |
} |
- if (loadTimeData.getBoolean('isUserSignedIn')) { |
- var message = loadTimeData.getString( |
- info.hasSyncedResults ? 'hasSyncedResults' : 'noSyncedResults'); |
- this.view_.showNotification(message); |
- } |
- |
this.updateSearch_(); |
}; |
@@ -1167,6 +1161,31 @@ HistoryView.prototype.showNotification = function(innerHTML, isWarning) { |
}; |
/** |
+ * Shows a notification about whether there are any synced results, and whether |
+ * there are other forms of browsing history on the server. |
+ * @param {boolean} hasSyncedResults Whether there are synced results. |
+ * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include |
+ * a sentence about the existence of other forms of browsing history. |
+ */ |
+HistoryView.prototype.showWebHistoryNotification = function( |
+ hasSyncedResults, includeOtherFormsOfBrowsingHistory) { |
+ var message = ''; |
+ |
+ if (loadTimeData.getBoolean('isUserSignedIn')) { |
+ message += '<span>' + loadTimeData.getString( |
+ hasSyncedResults ? 'hasSyncedResults' : 'noSyncedResults') + '</span>'; |
+ } |
+ |
+ if (includeOtherFormsOfBrowsingHistory) { |
+ message += ' ' /* A whitespace to separate <span>s. */ + '<span>' + |
+ loadTimeData.getString('otherFormsOfBrowsingHistory') + '</span>'; |
+ } |
+ |
+ if (message) |
+ this.showNotification(message); |
+}; |
+ |
+/** |
* @param {Visit} visit The visit about to be removed from this view. |
*/ |
HistoryView.prototype.onBeforeRemove = function(visit) { |
@@ -1274,15 +1293,15 @@ HistoryView.prototype.onEntryRemoved = function() { |
*/ |
HistoryView.prototype.positionNotificationBar = function() { |
var bar = $('notification-bar'); |
+ var container = $('top-container'); |
- // If the bar does not fit beside the editing controls, put it into the |
- // overflow state. |
- if (bar.getBoundingClientRect().top >= |
- $('editing-controls').getBoundingClientRect().bottom) { |
- bar.classList.add('alone'); |
- } else { |
- bar.classList.remove('alone'); |
- } |
+ // If the bar does not fit beside the editing controls, or if it contains |
+ // more than one message, put it into the overflow state. |
+ var shouldOverflow = |
+ (bar.getBoundingClientRect().top >= |
+ $('editing-controls').getBoundingClientRect().bottom) || |
+ bar.childElementCount > 1; |
+ container.classList.toggle('overflow', shouldOverflow); |
}; |
/** |
@@ -2346,6 +2365,19 @@ function historyResult(info, results) { |
} |
/** |
+ * Called by the history backend after receiving results and after discovering |
+ * the existence of other forms of browsing history. |
+ * @param {boolean} hasSyncedResults Whether there are synced results. |
+ * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include |
+ * a sentence about the existence of other forms of browsing history. |
+ */ |
+function showNotification( |
+ hasSyncedResults, includeOtherFormsOfBrowsingHistory) { |
+ historyView.showWebHistoryNotification( |
+ hasSyncedResults, includeOtherFormsOfBrowsingHistory); |
+} |
+ |
+/** |
* Called by the history backend when history removal is successful. |
*/ |
function deleteComplete() { |