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

Unified Diff: chrome/browser/resources/history/history.js

Issue 1838333004: Add a notice about other forms of browsing history to the History WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@desktop-ui-after-rebase
Patch Set: Moved build dependencies to OS!=iOS Created 4 years, 9 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/history/history.js
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js
index e67c903fbf9048662f3d37d619b4fd9ce0e6bcf9..539246a1340d3d497ad34cd1e8b0bf953954c1ce 100644
--- a/chrome/browser/resources/history/history.js
+++ b/chrome/browser/resources/history/history.js
@@ -644,13 +644,32 @@ HistoryModel.prototype.addResults = function(info, results) {
lastDay = thisDay;
}
+ this.updateSearch_();
+};
+
+/**
+ * Shows a notification explaining that there are other forms of browsing
+ * history present 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.
+ */
+HistoryModel.prototype.showNotification = function(
Dan Beam 2016/03/31 01:05:43 this belongs on the view instead
msramek 2016/03/31 19:20:01 Done. I originally put it here, since I extracted
+ hasSyncedResults, includeOtherFormsOfBrowsingHistory) {
+ var message = '';
+
if (loadTimeData.getBoolean('isUserSignedIn')) {
- var message = loadTimeData.getString(
- info.hasSyncedResults ? 'hasSyncedResults' : 'noSyncedResults');
- this.view_.showNotification(message);
+ message = '<div>' + loadTimeData.getString(
+ hasSyncedResults ? 'hasSyncedResults' : 'noSyncedResults') + '</div>';
}
- this.updateSearch_();
+ if (includeOtherFormsOfBrowsingHistory) {
+ message += '<div>' + loadTimeData.getString('otherFormsOfBrowsingHistory') +
+ '</div>';
+ }
+
+ if (message != '')
Dan Beam 2016/03/31 01:05:43 if (message)
msramek 2016/03/31 19:20:01 Done.
+ this.view_.showNotification(message);
};
/**
@@ -1274,14 +1293,16 @@ HistoryView.prototype.onEntryRemoved = function() {
*/
HistoryView.prototype.positionNotificationBar = function() {
var bar = $('notification-bar');
-
- // 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');
+ var container = $('top-container');
+
+ // If the bar does not fit beside the editing controls, or if it contains
+ // more than one message, put it into the overflow state.
+ if ((bar.getBoundingClientRect().top >=
+ $('editing-controls').getBoundingClientRect().bottom) ||
+ bar.childElementCount > 1) {
+ container.classList.add('overflow');
} else {
- bar.classList.remove('alone');
+ container.classList.remove('overflow');
Dan Beam 2016/03/31 01:05:43 var shouldOverflow = ...; $('container').classList
msramek 2016/03/31 19:20:01 Done.
}
};
@@ -2346,6 +2367,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) {
+ historyModel.showNotification(
Dan Beam 2016/03/31 01:05:43 historyView.showNotification
msramek 2016/03/31 19:20:01 Done. As mentioned above, let's rename it to showW
+ hasSyncedResults, includeOtherFormsOfBrowsingHistory);
+}
+
+/**
* Called by the history backend when history removal is successful.
*/
function deleteComplete() {

Powered by Google App Engine
This is Rietveld 408576698