OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function highlightIfChanged(node, oldVal, newVal) { | 5 function highlightIfChanged(node, oldVal, newVal) { |
6 function clearHighlight() { | 6 function clearHighlight() { |
7 this.removeAttribute('highlighted'); | 7 this.removeAttribute('highlighted'); |
8 } | 8 } |
9 | 9 |
10 var oldStr = oldVal.toString(); | 10 var oldStr = oldVal.toString(); |
(...skipping 16 matching lines...) Expand all Loading... |
27 function refreshAboutInfo(aboutInfo) { | 27 function refreshAboutInfo(aboutInfo) { |
28 chrome.sync.aboutInfo = aboutInfo; | 28 chrome.sync.aboutInfo = aboutInfo; |
29 var aboutInfoDiv = $('aboutInfo'); | 29 var aboutInfoDiv = $('aboutInfo'); |
30 jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv); | 30 jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv); |
31 } | 31 } |
32 | 32 |
33 function onLoad() { | 33 function onLoad() { |
34 $('status-data').hidden = true; | 34 $('status-data').hidden = true; |
35 chrome.sync.getAboutInfo(refreshAboutInfo); | 35 chrome.sync.getAboutInfo(refreshAboutInfo); |
36 | 36 |
37 chrome.sync.onServiceStateChanged.addListener(function() { | 37 chrome.sync.events.addEventListener( |
38 chrome.sync.getAboutInfo(refreshAboutInfo); | 38 'onServiceStateChanged', |
39 }); | 39 function(e) { |
| 40 chrome.sync.getAboutInfo(refreshAboutInfo); |
| 41 }); |
40 | 42 |
41 var dumpStatusButton = $('dump-status'); | 43 var dumpStatusButton = $('dump-status'); |
42 dumpStatusButton.addEventListener('click', function(event) { | 44 dumpStatusButton.addEventListener('click', function(event) { |
43 var aboutInfo = chrome.sync.aboutInfo; | 45 var aboutInfo = chrome.sync.aboutInfo; |
44 if (!$('include-ids').checked) { | 46 if (!$('include-ids').checked) { |
45 aboutInfo.details = chrome.sync.aboutInfo.details.filter(function(el) { | 47 aboutInfo.details = chrome.sync.aboutInfo.details.filter(function(el) { |
46 return !el.is_sensitive; | 48 return !el.is_sensitive; |
47 }); | 49 }); |
48 } | 50 } |
49 var data = ''; | 51 var data = ''; |
(...skipping 18 matching lines...) Expand all Loading... |
68 // First remove any characters before the '{'. | 70 // First remove any characters before the '{'. |
69 var data = $('status-text').value; | 71 var data = $('status-text').value; |
70 var firstBrace = data.indexOf('{'); | 72 var firstBrace = data.indexOf('{'); |
71 if (firstBrace < 0) { | 73 if (firstBrace < 0) { |
72 $('status-text').value = 'Invalid sync status dump.'; | 74 $('status-text').value = 'Invalid sync status dump.'; |
73 return; | 75 return; |
74 } | 76 } |
75 data = data.substr(firstBrace); | 77 data = data.substr(firstBrace); |
76 | 78 |
77 // Remove listeners to prevent sync events from overwriting imported data. | 79 // Remove listeners to prevent sync events from overwriting imported data. |
78 chrome.sync.onServiceStateChanged.removeListeners(); | 80 chrome.sync.events.removeEventListener( |
| 81 'onServiceStateChanged', |
| 82 refreshAboutInfo); |
79 | 83 |
80 var aboutInfo = JSON.parse(data); | 84 var aboutInfo = JSON.parse(data); |
81 refreshAboutInfo(aboutInfo); | 85 refreshAboutInfo(aboutInfo); |
82 }); | 86 }); |
83 } | 87 } |
84 | 88 |
85 document.addEventListener('DOMContentLoaded', onLoad, false); | 89 document.addEventListener('DOMContentLoaded', onLoad, false); |
86 })(); | 90 })(); |
OLD | NEW |