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

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: Another 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
« no previous file with comments | « no previous file | chrome/browser/resources/sync_internals/chrome_sync.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..59f284729a0447925a1a0d54de30a315b963a88d 100644
--- a/chrome/browser/resources/sync_internals/about.js
+++ b/chrome/browser/resources/sync_internals/about.js
@@ -22,23 +22,23 @@ 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) {
+ refreshAboutInfo(e.details);
+}
+
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 +78,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);
« no previous file with comments | « no previous file | chrome/browser/resources/sync_internals/chrome_sync.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698