[invalidations] Added a InvalidatorState last changed timestamp

This patch adds to about:invalidation a readable string next to the
InvalidatorState with the timestamp of the last time the
InvalidatorState changed. This is useful for detecting when there are
problems with the connection to the XMPP/GCM server, independantly of
Sync servers.

This patch is not a replacement of the log on the about:invalidations
page, as this timestamp is always updated even if the webpage is not
open, compared to the log that is only updated when events are relayed
in real time to the page. This new timestamp is useful for the cases
where we want to check how long has it been since we are in the same
state (like TRANSIENT_INVALIDATION_ERROR) and we could compare it to
different status timestamps in about:sync-internals or other
invalidations implementer.

BUG=263863

Review URL: https://codereview.chromium.org/222903004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262531 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/resources/about_invalidations.js b/chrome/browser/resources/about_invalidations.js
index 32d19b1..83a187a 100644
--- a/chrome/browser/resources/about_invalidations.js
+++ b/chrome/browser/resources/about_invalidations.js
@@ -54,14 +54,16 @@
   /**
    * Shows the current state of the InvalidatorService.
    * @param {string} newState The string to be displayed and logged.
+   * @param {number} lastChangedTime The time in epoch when the state was last
+   *     changed.
    */
-  function updateInvalidatorState(newState) {
+  function updateInvalidatorState(newState, lastChangedTime) {
     var logMessage = nowTimeString() +
       'Invalidations service state changed to ' + quote(newState);
 
     appendToLog(logMessage);
-    $('invalidations-state').textContent = newState;
-    currentInvalidationState = newState;
+    $('invalidations-state').textContent = newState + ' (since ' +
+        new Date(lastChangedTime) + ')';
   }
 
   /**