summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-02 20:40:13 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-02 20:40:13 +0000
commit22bc912e8ead4576e8fff27d49da8d75fd6802eb (patch)
treef33e9cff7bd7581a3f31969cf2bfcb832cb7a057 /chrome
parent2758c793c149246eda44f4843d4b3d72b00de434 (diff)
downloadchromium_src-22bc912e8ead4576e8fff27d49da8d75fd6802eb.zip
chromium_src-22bc912e8ead4576e8fff27d49da8d75fd6802eb.tar.gz
chromium_src-22bc912e8ead4576e8fff27d49da8d75fd6802eb.tar.bz2
Add content-security-policy directive to chrome://sync-internals
Review URL: http://codereview.chromium.org/7529012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/sync_internals/about.html24
-rw-r--r--chrome/browser/resources/sync_internals/about.js25
-rw-r--r--chrome/browser/resources/sync_internals/data.html33
-rw-r--r--chrome/browser/resources/sync_internals/data.js34
-rw-r--r--chrome/browser/resources/sync_internals/events.html39
-rw-r--r--chrome/browser/resources/sync_internals/events.js40
-rw-r--r--chrome/browser/resources/sync_internals/node_browser.html (renamed from chrome/browser/resources/sync_internals/sync_node_browser.html)5
-rw-r--r--chrome/browser/resources/sync_internals/node_browser.js6
-rw-r--r--chrome/browser/resources/sync_internals/notifications.html98
-rw-r--r--chrome/browser/resources/sync_internals/notifications.js99
-rw-r--r--chrome/browser/resources/sync_internals/search.html13
-rw-r--r--chrome/browser/resources/sync_internals/search.js14
-rw-r--r--chrome/browser/resources/sync_internals/sync_index.html28
-rw-r--r--chrome/browser/resources/sync_internals/sync_index.js12
-rw-r--r--chrome/browser/resources/sync_internals_resources.grd13
-rw-r--r--chrome/browser/ui/webui/sync_internals_html_source.cc44
-rw-r--r--chrome/browser/ui/webui/sync_internals_html_source.h31
-rw-r--r--chrome/browser/ui/webui/sync_internals_ui.cc36
-rw-r--r--chrome/chrome_browser.gypi2
19 files changed, 293 insertions, 303 deletions
diff --git a/chrome/browser/resources/sync_internals/about.html b/chrome/browser/resources/sync_internals/about.html
index 901e24b..40fac13 100644
--- a/chrome/browser/resources/sync_internals/about.html
+++ b/chrome/browser/resources/sync_internals/about.html
@@ -1,26 +1,4 @@
-<script>
-(function () {
-// 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 = document.getElementById('aboutInfo');
- jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv);
-}
-
-function onLoad() {
- chrome.sync.getAboutInfo(refreshAboutInfo);
- chrome.sync.onServiceStateChanged.addListener(function() {
- chrome.sync.getAboutInfo(refreshAboutInfo);
- });
-}
-
-document.addEventListener("DOMContentLoaded", onLoad, false);
-})();
-</script>
+<script src="chrome://sync-internals/about.js"></script>
<style>
div.column {
diff --git a/chrome/browser/resources/sync_internals/about.js b/chrome/browser/resources/sync_internals/about.js
new file mode 100644
index 0000000..1552670d
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/about.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function () {
+// 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 = document.getElementById('aboutInfo');
+ jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv);
+}
+
+function onLoad() {
+ chrome.sync.getAboutInfo(refreshAboutInfo);
+ chrome.sync.onServiceStateChanged.addListener(function() {
+ chrome.sync.getAboutInfo(refreshAboutInfo);
+ });
+}
+
+document.addEventListener("DOMContentLoaded", onLoad, false);
+})();
diff --git a/chrome/browser/resources/sync_internals/data.html b/chrome/browser/resources/sync_internals/data.html
index 732bbf5..27992b3 100644
--- a/chrome/browser/resources/sync_internals/data.html
+++ b/chrome/browser/resources/sync_internals/data.html
@@ -8,35 +8,4 @@ careful about posting data dumps on bug reports.</strong></p>
<pre id="data-dump"></pre>
-<script>
-(function() {
-var dumpToTextButton = document.getElementById('dump-to-text');
-var dataDump = document.getElementById('data-dump');
-dumpToTextButton.addEventListener('click', function(event) {
- // TODO(akalin): Add info like Chrome version, OS, date dumped, etc.
-
- var data = '';
- data += '======\n';
- data += 'Status\n';
- data += '======\n';
- data += JSON.stringify(chrome.sync.aboutInfo, null, 2);
- data += '\n';
- data += '\n';
-
- data += '=============\n';
- data += 'Notifications\n';
- data += '=============\n';
- data += JSON.stringify(chrome.sync.notifications, null, 2);
- data += '\n';
- data += '\n';
-
- data += '===\n';
- data += 'Log\n';
- data += '===\n';
- data += JSON.stringify(chrome.sync.log.entries, null, 2);
- data += '\n';
-
- dataDump.textContent = data;
-});
-})();
-</script>
+<script src="chrome://sync-internals/data.js"></script>
diff --git a/chrome/browser/resources/sync_internals/data.js b/chrome/browser/resources/sync_internals/data.js
new file mode 100644
index 0000000..1016a05
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/data.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+var dumpToTextButton = document.getElementById('dump-to-text');
+var dataDump = document.getElementById('data-dump');
+dumpToTextButton.addEventListener('click', function(event) {
+ // TODO(akalin): Add info like Chrome version, OS, date dumped, etc.
+
+ var data = '';
+ data += '======\n';
+ data += 'Status\n';
+ data += '======\n';
+ data += JSON.stringify(chrome.sync.aboutInfo, null, 2);
+ data += '\n';
+ data += '\n';
+
+ data += '=============\n';
+ data += 'Notifications\n';
+ data += '=============\n';
+ data += JSON.stringify(chrome.sync.notifications, null, 2);
+ data += '\n';
+ data += '\n';
+
+ data += '===\n';
+ data += 'Log\n';
+ data += '===\n';
+ data += JSON.stringify(chrome.sync.log.entries, null, 2);
+ data += '\n';
+
+ dataDump.textContent = data;
+});
+})();
diff --git a/chrome/browser/resources/sync_internals/events.html b/chrome/browser/resources/sync_internals/events.html
index 51f57aa..b1883e7 100644
--- a/chrome/browser/resources/sync_internals/events.html
+++ b/chrome/browser/resources/sync_internals/events.html
@@ -25,41 +25,4 @@
</tbody>
</table>
-<script>
-(function() {
-function makeLogEntryNode(entry) {
- var timeNode = document.createElement('td');
- timeNode.textContent = entry.date;
-
- var submoduleNode = document.createElement('td');
- submoduleNode.textContent = entry.submodule;
-
- var eventNode = document.createElement('td');
- eventNode.textContent = entry.event;
-
- var details = document.createElement('pre');
- details.textContent = JSON.stringify(entry.details, null, 2);
- var detailsNode = document.createElement('td');
- detailsNode.appendChild(details);
-
- var node = document.createElement('tr');
- node.appendChild(timeNode);
- node.appendChild(submoduleNode);
- node.appendChild(eventNode);
- node.appendChild(detailsNode);
-
- return node;
-}
-
-var syncEvents = document.getElementById('sync-events');
-
-var entries = chrome.sync.log.entries;
-for (var i = 0; i < entries.length; ++i) {
- syncEvents.appendChild(makeLogEntryNode(entries[i]));
-}
-
-chrome.sync.log.addEventListener('append', function(event) {
- syncEvents.appendChild(makeLogEntryNode(event.detail));
-});
-})();
-</script>
+<script src="chrome://sync-internals/events.js"></script>
diff --git a/chrome/browser/resources/sync_internals/events.js b/chrome/browser/resources/sync_internals/events.js
new file mode 100644
index 0000000..0cda086
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/events.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+function makeLogEntryNode(entry) {
+ var timeNode = document.createElement('td');
+ timeNode.textContent = entry.date;
+
+ var submoduleNode = document.createElement('td');
+ submoduleNode.textContent = entry.submodule;
+
+ var eventNode = document.createElement('td');
+ eventNode.textContent = entry.event;
+
+ var details = document.createElement('pre');
+ details.textContent = JSON.stringify(entry.details, null, 2);
+ var detailsNode = document.createElement('td');
+ detailsNode.appendChild(details);
+
+ var node = document.createElement('tr');
+ node.appendChild(timeNode);
+ node.appendChild(submoduleNode);
+ node.appendChild(eventNode);
+ node.appendChild(detailsNode);
+
+ return node;
+}
+
+var syncEvents = document.getElementById('sync-events');
+
+var entries = chrome.sync.log.entries;
+for (var i = 0; i < entries.length; ++i) {
+ syncEvents.appendChild(makeLogEntryNode(entries[i]));
+}
+
+chrome.sync.log.addEventListener('append', function(event) {
+ syncEvents.appendChild(makeLogEntryNode(event.detail));
+});
+})();
diff --git a/chrome/browser/resources/sync_internals/sync_node_browser.html b/chrome/browser/resources/sync_internals/node_browser.html
index 193bf78..47a56c7 100644
--- a/chrome/browser/resources/sync_internals/sync_node_browser.html
+++ b/chrome/browser/resources/sync_internals/node_browser.html
@@ -61,7 +61,4 @@ item detail on the lower right. -->
</div>
</div>
-<script>
-chrome.sync.decorateSyncNodeBrowser('sync-node-tree');
-cr.ui.decorate('#sync-node-splitter', cr.ui.Splitter);
-</script>
+<script src="chrome://sync-internals/node_browser.js"></script>
diff --git a/chrome/browser/resources/sync_internals/node_browser.js b/chrome/browser/resources/sync_internals/node_browser.js
new file mode 100644
index 0000000..03f561b
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/node_browser.js
@@ -0,0 +1,6 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.sync.decorateSyncNodeBrowser('sync-node-tree');
+cr.ui.decorate('#sync-node-splitter', cr.ui.Splitter);
diff --git a/chrome/browser/resources/sync_internals/notifications.html b/chrome/browser/resources/sync_internals/notifications.html
index 0916fc5..4c089b4 100644
--- a/chrome/browser/resources/sync_internals/notifications.html
+++ b/chrome/browser/resources/sync_internals/notifications.html
@@ -1,100 +1,4 @@
-<script>
-(function () {
-
-// TODO(akalin): Use table.js.
-
-function updateNotificationsEnabledInfo(notificationsEnabled) {
- var notificationsEnabledInfo =
- document.getElementById('notificationsEnabledInfo');
- jstProcess(
- new JsEvalContext({ 'notificationsEnabled': notificationsEnabled }),
- notificationsEnabledInfo);
-}
-
-// Contains all notification data. The keys are sync types (as strings) and
-// the value is a dictionary with:
-//
-// type: the sync type again (for convenience when using JsTemplate)
-// totalCount: Number of notifications received since browser start.
-// sessionCount: Number of notifications received this
-// chrome://sync-internals session.
-// payload: The last received payload.
-//
-chrome.sync.notifications = {};
-
-/**
- * Merges d1 and d2 (with d2 taking precedence) and returns the result.
- */
-function mergeDictionaries(d1, d2) {
- var d = {};
- for (var k in d1) {
- d[k] = d1[k];
- }
- for (var k in d2) {
- d[k] = d2[k];
- }
- return d;
-}
-
-/**
- * Merge notificationInfo into chrome.sync.notifications.
- */
-function updateNotificationsFromNotificationInfo(notificationInfo) {
- for (var k in notificationInfo) {
- chrome.sync.notifications[k] =
- mergeDictionaries(chrome.sync.notifications[k] || {},
- notificationInfo[k]);
- // notificationInfo[k] has values for the totalCount and payload keys,
- // so fill in the rest (if necessary).
- chrome.sync.notifications[k].type = k;
- chrome.sync.notifications[k].sessionCount =
- chrome.sync.notifications[k].sessionCount || 0;
- }
-}
-
-function incrementSessionNotificationCount(changedType) {
- chrome.sync.notifications[changedType].sessionCount =
- chrome.sync.notifications[changedType].sessionCount || 0;
- ++chrome.sync.notifications[changedType].sessionCount;
-}
-
-function updateNotificationInfoTable() {
- var notificationInfoTable =
- document.getElementById('notificationInfo');
- var infos = [];
- for (var k in chrome.sync.notifications) {
- infos.push(chrome.sync.notifications[k]);
- }
- jstProcess(new JsEvalContext({ 'notifications': infos }),
- notificationInfoTable);
-}
-
-function updateNotificationInfo(notificationInfo) {
- updateNotificationsFromNotificationInfo(notificationInfo);
- updateNotificationInfoTable();
-}
-
-function onLoad() {
- chrome.sync.getNotificationState(updateNotificationsEnabledInfo);
- chrome.sync.getNotificationInfo(updateNotificationInfo);
- chrome.sync.onNotificationStateChange.addListener(
- function(details) { updateNotificationsEnabledInfo(details.enabled); });
-
- chrome.sync.onIncomingNotification.addListener(function(details) {
- var changedTypes = details.changedTypes;
- for (var i = 0; i < changedTypes.length; ++i) {
- incrementSessionNotificationCount(changedTypes[i]);
- }
- updateNotificationInfoTable();
-
- // Also update total counts.
- chrome.sync.getNotificationInfo(updateNotificationInfo);
- });
-}
-
-document.addEventListener("DOMContentLoaded", onLoad, false);
-})();
-</script>
+<script src="chrome://sync-internals/notifications.js"></script>
<style>
table#notificationInfo tr:nth-child(odd) {
diff --git a/chrome/browser/resources/sync_internals/notifications.js b/chrome/browser/resources/sync_internals/notifications.js
new file mode 100644
index 0000000..b6e651e
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/notifications.js
@@ -0,0 +1,99 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function () {
+
+// TODO(akalin): Use table.js.
+
+function updateNotificationsEnabledInfo(notificationsEnabled) {
+ var notificationsEnabledInfo =
+ document.getElementById('notificationsEnabledInfo');
+ jstProcess(
+ new JsEvalContext({ 'notificationsEnabled': notificationsEnabled }),
+ notificationsEnabledInfo);
+}
+
+// Contains all notification data. The keys are sync types (as strings) and
+// the value is a dictionary with:
+//
+// type: the sync type again (for convenience when using JsTemplate)
+// totalCount: Number of notifications received since browser start.
+// sessionCount: Number of notifications received this
+// chrome://sync-internals session.
+// payload: The last received payload.
+//
+chrome.sync.notifications = {};
+
+/**
+ * Merges d1 and d2 (with d2 taking precedence) and returns the result.
+ */
+function mergeDictionaries(d1, d2) {
+ var d = {};
+ for (var k in d1) {
+ d[k] = d1[k];
+ }
+ for (var k in d2) {
+ d[k] = d2[k];
+ }
+ return d;
+}
+
+/**
+ * Merge notificationInfo into chrome.sync.notifications.
+ */
+function updateNotificationsFromNotificationInfo(notificationInfo) {
+ for (var k in notificationInfo) {
+ chrome.sync.notifications[k] =
+ mergeDictionaries(chrome.sync.notifications[k] || {},
+ notificationInfo[k]);
+ // notificationInfo[k] has values for the totalCount and payload keys,
+ // so fill in the rest (if necessary).
+ chrome.sync.notifications[k].type = k;
+ chrome.sync.notifications[k].sessionCount =
+ chrome.sync.notifications[k].sessionCount || 0;
+ }
+}
+
+function incrementSessionNotificationCount(changedType) {
+ chrome.sync.notifications[changedType].sessionCount =
+ chrome.sync.notifications[changedType].sessionCount || 0;
+ ++chrome.sync.notifications[changedType].sessionCount;
+}
+
+function updateNotificationInfoTable() {
+ var notificationInfoTable =
+ document.getElementById('notificationInfo');
+ var infos = [];
+ for (var k in chrome.sync.notifications) {
+ infos.push(chrome.sync.notifications[k]);
+ }
+ jstProcess(new JsEvalContext({ 'notifications': infos }),
+ notificationInfoTable);
+}
+
+function updateNotificationInfo(notificationInfo) {
+ updateNotificationsFromNotificationInfo(notificationInfo);
+ updateNotificationInfoTable();
+}
+
+function onLoad() {
+ chrome.sync.getNotificationState(updateNotificationsEnabledInfo);
+ chrome.sync.getNotificationInfo(updateNotificationInfo);
+ chrome.sync.onNotificationStateChange.addListener(
+ function(details) { updateNotificationsEnabledInfo(details.enabled); });
+
+ chrome.sync.onIncomingNotification.addListener(function(details) {
+ var changedTypes = details.changedTypes;
+ for (var i = 0; i < changedTypes.length; ++i) {
+ incrementSessionNotificationCount(changedTypes[i]);
+ }
+ updateNotificationInfoTable();
+
+ // Also update total counts.
+ chrome.sync.getNotificationInfo(updateNotificationInfo);
+ });
+}
+
+document.addEventListener("DOMContentLoaded", onLoad, false);
+})();
diff --git a/chrome/browser/resources/sync_internals/search.html b/chrome/browser/resources/sync_internals/search.html
index 2e08440..01186f8 100644
--- a/chrome/browser/resources/sync_internals/search.html
+++ b/chrome/browser/resources/sync_internals/search.html
@@ -12,15 +12,4 @@
</div>
</div>
-<script>
-// require: cr/ui.js
-// require: util.js
-
-cr.ui.decorate('#sync-results-splitter', cr.ui.Splitter);
-
-chrome.sync.decorateSearchControls(
- $('sync-search-query'),
- $('sync-search-status'),
- $('sync-results-list'),
- $('sync-result-details'));
-</script>
+<script src="chrome://sync-internals/search.js"></script>
diff --git a/chrome/browser/resources/sync_internals/search.js b/chrome/browser/resources/sync_internals/search.js
new file mode 100644
index 0000000..08c6875
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/search.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// require: cr/ui.js
+// require: util.js
+
+cr.ui.decorate('#sync-results-splitter', cr.ui.Splitter);
+
+chrome.sync.decorateSearchControls(
+ $('sync-search-query'),
+ $('sync-search-status'),
+ $('sync-results-list'),
+ $('sync-result-details'));
diff --git a/chrome/browser/resources/sync_internals/sync_index.html b/chrome/browser/resources/sync_internals/sync_index.html
index b9940c1..4d2c5d9 100644
--- a/chrome/browser/resources/sync_internals/sync_index.html
+++ b/chrome/browser/resources/sync_internals/sync_index.html
@@ -4,6 +4,7 @@
<!-- If you change the title, make sure you also update
chrome/test/functional/special_tabs.py. -->
<title>Sync Internals</title>
+<include src="../content_security_policy.html"/>
<link rel="stylesheet" href="chrome://resources/css/list.css">
<link rel="stylesheet" href="chrome://resources/css/tabs.css">
<link rel="stylesheet" href="chrome://resources/css/tree.css">
@@ -24,14 +25,14 @@ chrome/test/functional/special_tabs.py. -->
<script src="chrome://resources/js/cr/ui/list_selection_controller.js"></script>
<script src="chrome://resources/js/cr/ui/list_selection_model.js"></script>
<script src="chrome://resources/js/cr/ui/list.js"></script>
-
<script src="chrome://resources/js/cr/ui/tabs.js"></script>
<script src="chrome://resources/js/cr/ui/tree.js"></script>
<script src="chrome://resources/js/util.js"></script>
-<script src="chrome_sync.js"></script>
-<script src="sync_log.js"></script>
-<script src="sync_node_browser.js"></script>
-<script src="sync_search.js"></script>
+<script src="chrome://sync-internals/chrome_sync.js"></script>
+<script src="chrome://sync-internals/sync_log.js"></script>
+<script src="chrome://sync-internals/sync_node_browser.js"></script>
+<script src="chrome://sync-internals/sync_search.js"></script>
+<script src="chrome://sync-internals/strings.js"></script>
</head>
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
@@ -66,7 +67,7 @@ chrome/test/functional/special_tabs.py. -->
<include src="events.html" />
</tabpanel>
<tabpanel>
- <include src="sync_node_browser.html" />
+ <include src="node_browser.html" />
</tabpanel>
<tabpanel>
<include src="search.html" />
@@ -74,16 +75,9 @@ chrome/test/functional/special_tabs.py. -->
</tabpanels>
</tabbox>
-<script>
-// Allow platform specific CSS rules.
-//
-// TODO(akalin): BMM and options page does something similar, too.
-// Move this to util.js.
-if (cr.isWindows)
- document.documentElement.setAttribute('os', 'win');
-
-cr.ui.decorate('tabbox', cr.ui.TabBox);
-</script>
-
+<script src="chrome://resources/js/i18n_template.js"></script>
+<script src="chrome://resources/js/i18n_process.js"></script>
+<script src="chrome://resources/js/jstemplate_compiled.js"></script>
+<script src="chrome://sync-internals/sync_index.js"></script>
</body>
</html>
diff --git a/chrome/browser/resources/sync_internals/sync_index.js b/chrome/browser/resources/sync_internals/sync_index.js
new file mode 100644
index 0000000..7cce623
--- /dev/null
+++ b/chrome/browser/resources/sync_internals/sync_index.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Allow platform specific CSS rules.
+//
+// TODO(akalin): BMM and options page does something similar, too.
+// Move this to util.js.
+if (cr.isWindows)
+ document.documentElement.setAttribute('os', 'win');
+
+cr.ui.decorate('tabbox', cr.ui.TabBox);
diff --git a/chrome/browser/resources/sync_internals_resources.grd b/chrome/browser/resources/sync_internals_resources.grd
index 1c5c98b..39da8cb 100644
--- a/chrome/browser/resources/sync_internals_resources.grd
+++ b/chrome/browser/resources/sync_internals_resources.grd
@@ -18,7 +18,18 @@
<release seq="1">
<includes>
<!-- TODO(akalin): rename back to index.html once bug 69633 is fixed. -->
- <include name="IDR_SYNC_INTERNALS_INDEX_HTML" file="sync_internals/sync_index.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_INDEX_HTML" file="sync_internals/sync_index.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_INDEX_JS" file="sync_internals/sync_index.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_CHROME_SYNC_JS" file="sync_internals/chrome_sync.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_SYNC_LOG_JS" file="sync_internals/sync_log.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_SYNC_NODE_BROWSER_JS" file="sync_internals/sync_node_browser.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_SYNC_SEARCH_JS" file="sync_internals/sync_search.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_ABOUT_JS" file="sync_internals/about.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_DATA_JS" file="sync_internals/data.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_EVENTS_JS" file="sync_internals/events.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_NOTIFICATIONS_JS" file="sync_internals/notifications.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_SEARCH_JS" file="sync_internals/search.js" type="BINDATA" />
+ <include name="IDR_SYNC_INTERNALS_NODE_BROWSER_JS" file="sync_internals/node_browser.js" type="BINDATA" />
</includes>
</release>
</grit>
diff --git a/chrome/browser/ui/webui/sync_internals_html_source.cc b/chrome/browser/ui/webui/sync_internals_html_source.cc
deleted file mode 100644
index 6e5333c..0000000
--- a/chrome/browser/ui/webui/sync_internals_html_source.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/sync_internals_html_source.h"
-
-#include "base/memory/ref_counted.h"
-#include "base/memory/ref_counted_memory.h"
-#include "base/message_loop.h"
-#include "base/string_piece.h"
-#include "base/values.h"
-#include "chrome/common/jstemplate_builder.h"
-#include "chrome/common/url_constants.h"
-#include "grit/sync_internals_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-
-SyncInternalsHTMLSource::SyncInternalsHTMLSource()
- : DataSource(chrome::kChromeUISyncInternalsHost,
- MessageLoop::current()) {}
-
-SyncInternalsHTMLSource::~SyncInternalsHTMLSource() {}
-
-void SyncInternalsHTMLSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
- base::StringPiece html_template(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_SYNC_INTERNALS_INDEX_HTML));
- DictionaryValue localized_strings;
- SetFontAndTextDirection(&localized_strings);
-
- std::string html(html_template.data(), html_template.size());
- jstemplate_builder::AppendI18nTemplateSourceHtml(&html);
- jstemplate_builder::AppendJsTemplateSourceHtml(&html);
- jstemplate_builder::AppendJsonHtml(&localized_strings, &html);
- jstemplate_builder::AppendI18nTemplateProcessHtml(&html);
-
- SendResponse(request_id, base::RefCountedString::TakeString(&html));
-}
-
-std::string SyncInternalsHTMLSource::GetMimeType(
- const std::string& path) const {
- return "text/html";
-}
diff --git a/chrome/browser/ui/webui/sync_internals_html_source.h b/chrome/browser/ui/webui/sync_internals_html_source.h
deleted file mode 100644
index 6ef23ff..0000000
--- a/chrome/browser/ui/webui/sync_internals_html_source.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_HTML_SOURCE_H_
-#define CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_HTML_SOURCE_H_
-#pragma once
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
-
-class SyncInternalsHTMLSource : public ChromeURLDataManager::DataSource {
- public:
- SyncInternalsHTMLSource();
-
- // ChromeURLDataManager::DataSource implementation.
- virtual void StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id);
- virtual std::string GetMimeType(const std::string& path) const;
-
- protected:
- virtual ~SyncInternalsHTMLSource();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SyncInternalsHTMLSource);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_HTML_SOURCE_H_
diff --git a/chrome/browser/ui/webui/sync_internals_ui.cc b/chrome/browser/ui/webui/sync_internals_ui.cc
index 529304e..25adb33 100644
--- a/chrome/browser/ui/webui/sync_internals_ui.cc
+++ b/chrome/browser/ui/webui/sync_internals_ui.cc
@@ -20,9 +20,41 @@
#include "chrome/browser/sync/weak_handle.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
-#include "chrome/browser/ui/webui/sync_internals_html_source.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/extensions/extension_messages.h"
+#include "chrome/common/url_constants.h"
#include "content/browser/browser_thread.h"
+#include "grit/sync_internals_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace {
+
+ChromeWebUIDataSource* CreateSyncInternalsHTMLSource() {
+ ChromeWebUIDataSource* source =
+ new ChromeWebUIDataSource(chrome::kChromeUISyncInternalsHost);
+
+ source->set_json_path("strings.js");
+ source->add_resource_path("sync_index.js", IDR_SYNC_INTERNALS_INDEX_JS);
+ source->add_resource_path("chrome_sync.js",
+ IDR_SYNC_INTERNALS_CHROME_SYNC_JS);
+ source->add_resource_path("sync_log.js", IDR_SYNC_INTERNALS_SYNC_LOG_JS);
+ source->add_resource_path("sync_node_browser.js",
+ IDR_SYNC_INTERNALS_SYNC_NODE_BROWSER_JS);
+ source->add_resource_path("sync_search.js",
+ IDR_SYNC_INTERNALS_SYNC_SEARCH_JS);
+ source->add_resource_path("about.js", IDR_SYNC_INTERNALS_ABOUT_JS);
+ source->add_resource_path("data.js", IDR_SYNC_INTERNALS_DATA_JS);
+ source->add_resource_path("events.js", IDR_SYNC_INTERNALS_EVENTS_JS);
+ source->add_resource_path("notifications.js",
+ IDR_SYNC_INTERNALS_NOTIFICATIONS_JS);
+ source->add_resource_path("search.js", IDR_SYNC_INTERNALS_SEARCH_JS);
+ source->add_resource_path("node_browser.js",
+ IDR_SYNC_INTERNALS_NODE_BROWSER_JS);
+ source->set_default_resource(IDR_SYNC_INTERNALS_INDEX_HTML);
+ return source;
+}
+
+} // namespace
using browser_sync::JsArgList;
using browser_sync::JsEventDetails;
@@ -45,7 +77,7 @@ SyncInternalsUI::SyncInternalsUI(TabContents* contents)
// TODO(akalin): Fix.
Profile* profile = Profile::FromBrowserContext(contents->browser_context());
profile->GetChromeURLDataManager()->AddDataSource(
- new SyncInternalsHTMLSource());
+ CreateSyncInternalsHTMLSource());
ProfileSyncService* sync_service = GetProfileSyncService(profile);
if (sync_service) {
js_controller_ = sync_service->GetJsController();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index e711143..12c0ff9 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3641,8 +3641,6 @@
'browser/ui/webui/sessions_ui.h',
'browser/ui/webui/shared_resources_data_source.cc',
'browser/ui/webui/shared_resources_data_source.h',
- 'browser/ui/webui/sync_internals_html_source.cc',
- 'browser/ui/webui/sync_internals_html_source.h',
'browser/ui/webui/sync_internals_ui.cc',
'browser/ui/webui/sync_internals_ui.h',
'browser/ui/webui/sync_setup_handler.cc',