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

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

Issue 2569663004: [NTPSnippets] Switch from TickClock to Clock for storing the last background fetched time. (Closed)
Patch Set: Add a DCHECK to check that the num or args passed to the new method is 0 Created 4 years 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/snippets_internals.js
diff --git a/chrome/browser/resources/snippets_internals.js b/chrome/browser/resources/snippets_internals.js
index 3cf3560d2ff095c54d029fce7078523c79b5a0c4..7be658a039ea1605cef9046d4eb92cecac8d5fcd 100644
--- a/chrome/browser/resources/snippets_internals.js
+++ b/chrome/browser/resources/snippets_internals.js
@@ -33,6 +33,11 @@ cr.define('chrome.SnippetsInternals', function() {
event.preventDefault();
});
+ $('background-fetch-button').addEventListener('click', function(event) {
+ chrome.send('fetchRemoteSuggestionsInTheBackground');
+ event.preventDefault();
+ });
+
window.addEventListener('focus', refreshContent);
window.setInterval(refreshContent, 1000);
@@ -108,6 +113,12 @@ cr.define('chrome.SnippetsInternals', function() {
receiveProperty('avg-time-to-use', timeToUse);
}
+ function receiveLastRemoteSuggestionsBackgroundFetchTime(
+ lastRemoteSuggestionsBackgroundFetchTime) {
+ receiveProperty('last-background-fetch-time-label',
+ lastRemoteSuggestionsBackgroundFetchTime);
+ }
+
function downloadJson(json) {
// Redirect the browser to download data in |json| as a file "snippets.json"
// (Setting Content-Disposition: attachment via a data: URL is not possible;
@@ -157,6 +168,8 @@ cr.define('chrome.SnippetsInternals', function() {
receiveContentSuggestions: receiveContentSuggestions,
receiveJson: receiveJson,
receiveClassification: receiveClassification,
+ receiveLastRemoteSuggestionsBackgroundFetchTime:
+ receiveLastRemoteSuggestionsBackgroundFetchTime,
};
});
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698