Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / sync_internals / about.js
index d915fd7..59f2847 100644 (file)
@@ -22,21 +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.onServiceStateChanged.addListener(function() {
-    chrome.sync.getAboutInfo(refreshAboutInfo);
-  });
+  chrome.sync.events.addEventListener(
+      'onAboutInfoUpdated',
+      onAboutInfoUpdatedEvent);
+  chrome.sync.requestUpdatedAboutInfo();
 
   var dumpStatusButton = $('dump-status');
   dumpStatusButton.addEventListener('click', function(event) {
@@ -75,7 +77,9 @@ function onLoad() {
     data = data.substr(firstBrace);
 
     // Remove listeners to prevent sync events from overwriting imported data.
-    chrome.sync.onServiceStateChanged.removeListeners();
+    chrome.sync.events.removeEventListener(
+        'onAboutInfoUpdated',
+        onAboutInfoUpdatedEvent);
 
     var aboutInfo = JSON.parse(data);
     refreshAboutInfo(aboutInfo);