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

Unified Diff: chrome/browser/resources/sync_internals/about.js

Issue 162283002: Move towards event-driven JS on about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix some issues (reupload) Created 6 years, 10 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/sync_internals/about.js
diff --git a/chrome/browser/resources/sync_internals/about.js b/chrome/browser/resources/sync_internals/about.js
index 7136b903431dbdb7f432ec6916df45c363407b54..1c5943e641ceb2dc8ae2cc46a833ea69fe339c1b 100644
--- a/chrome/browser/resources/sync_internals/about.js
+++ b/chrome/browser/resources/sync_internals/about.js
@@ -22,23 +22,24 @@ function highlightIfChanged(node, oldVal, newVal) {
// Contains the latest snapshot of sync about info.
chrome.sync.aboutInfo = {};
-// TODO(akalin): Make aboutInfo have key names likeThis and not
-// like_this.
function refreshAboutInfo(aboutInfo) {
chrome.sync.aboutInfo = aboutInfo;
var aboutInfoDiv = $('aboutInfo');
jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv);
}
+function onAboutInfoUpdatedEvent(e) {
+ var aboutInfo = e.details;
+ refreshAboutInfo(aboutInfo);
Dan Beam 2014/02/13 22:32:45 nit: refreshAboutInfo(e.details);
rlarocque 2014/02/13 23:34:30 Done.
+}
+
function onLoad() {
$('status-data').hidden = true;
- chrome.sync.getAboutInfo(refreshAboutInfo);
chrome.sync.events.addEventListener(
- 'onServiceStateChanged',
- function(e) {
- chrome.sync.getAboutInfo(refreshAboutInfo);
- });
+ 'onAboutInfoUpdated',
+ onAboutInfoUpdatedEvent);
+ chrome.sync.requestUpdatedAboutInfo();
var dumpStatusButton = $('dump-status');
dumpStatusButton.addEventListener('click', function(event) {
@@ -78,8 +79,8 @@ function onLoad() {
// Remove listeners to prevent sync events from overwriting imported data.
chrome.sync.events.removeEventListener(
- 'onServiceStateChanged',
- refreshAboutInfo);
+ 'onAboutInfoUpdated',
+ onAboutInfoUpdatedEvent);
var aboutInfo = JSON.parse(data);
refreshAboutInfo(aboutInfo);

Powered by Google App Engine
This is Rietveld 408576698