summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/extensions/api/bookmarks.json4
-rw-r--r--chrome/common/extensions/api/browserAction.json4
-rw-r--r--chrome/common/extensions/api/browsingData.json4
-rw-r--r--chrome/common/extensions/api/chromeAuthPrivate.json4
-rw-r--r--chrome/common/extensions/api/chromePrivate.json4
-rw-r--r--chrome/common/extensions/api/chromeosInfoPrivate.json4
-rw-r--r--chrome/common/extensions/api/contentSettings.json4
-rw-r--r--chrome/common/extensions/api/contextMenus.json4
-rw-r--r--chrome/common/extensions/api/cookies.json4
-rw-r--r--chrome/common/extensions/api/debugger.json4
-rw-r--r--chrome/common/extensions/api/devtools.json4
-rw-r--r--chrome/common/extensions/api/devtools_api.json4
-rw-r--r--chrome/common/extensions/api/experimental.accessibility.json4
-rw-r--r--chrome/common/extensions/api/experimental.app.json4
-rw-r--r--chrome/common/extensions/api/experimental.bookmarkManager.json4
-rw-r--r--chrome/common/extensions/api/experimental.declarative.json4
-rw-r--r--chrome/common/extensions/api/experimental.dns.json4
-rw-r--r--chrome/common/extensions/api/experimental.downloads.json4
-rw-r--r--chrome/common/extensions/api/experimental.extension.json4
-rw-r--r--chrome/common/extensions/api/experimental.fonts.json4
-rw-r--r--chrome/common/extensions/api/experimental.infobars.json4
-rw-r--r--chrome/common/extensions/api/experimental.input.ui.json4
-rw-r--r--chrome/common/extensions/api/experimental.input.virtualKeyboard.json4
-rw-r--r--chrome/common/extensions/api/experimental.keybinding.json4
-rw-r--r--chrome/common/extensions/api/experimental.processes.json4
-rw-r--r--chrome/common/extensions/api/experimental.rlz.json4
-rw-r--r--chrome/common/extensions/api/experimental.serial.json4
-rw-r--r--chrome/common/extensions/api/experimental.socket.json4
-rw-r--r--chrome/common/extensions/api/experimental.speechInput.json4
-rw-r--r--chrome/common/extensions/api/experimental.topSites.json4
-rw-r--r--chrome/common/extensions/api/extension.json4
-rw-r--r--chrome/common/extensions/api/fileBrowserHandler.json4
-rw-r--r--chrome/common/extensions/api/fileBrowserPrivate.json4
-rw-r--r--chrome/common/extensions/api/history.json4
-rw-r--r--chrome/common/extensions/api/i18n.json4
-rw-r--r--chrome/common/extensions/api/idle.json4
-rw-r--r--chrome/common/extensions/api/input.ime.json4
-rw-r--r--chrome/common/extensions/api/inputMethodPrivate.json4
-rw-r--r--chrome/common/extensions/api/management.json4
-rw-r--r--chrome/common/extensions/api/mediaPlayerPrivate.json4
-rw-r--r--chrome/common/extensions/api/metricsPrivate.json4
-rw-r--r--chrome/common/extensions/api/omnibox.json4
-rw-r--r--chrome/common/extensions/api/pageAction.json4
-rw-r--r--chrome/common/extensions/api/pageActions.json4
-rw-r--r--chrome/common/extensions/api/pageCapture.json4
-rw-r--r--chrome/common/extensions/api/permissions.json4
-rw-r--r--chrome/common/extensions/api/privacy.json4
-rw-r--r--chrome/common/extensions/api/proxy.json4
-rw-r--r--chrome/common/extensions/api/storage.json4
-rw-r--r--chrome/common/extensions/api/systemPrivate.json4
-rw-r--r--chrome/common/extensions/api/tabs.json4
-rw-r--r--chrome/common/extensions/api/terminalPrivate.json4
-rw-r--r--chrome/common/extensions/api/test.json4
-rw-r--r--chrome/common/extensions/api/tts.json4
-rw-r--r--chrome/common/extensions/api/ttsEngine.json4
-rw-r--r--chrome/common/extensions/api/types.json4
-rw-r--r--chrome/common/extensions/api/webNavigation.json4
-rw-r--r--chrome/common/extensions/api/webRequest.json4
-rw-r--r--chrome/common/extensions/api/webSocketProxyPrivate.json4
-rw-r--r--chrome/common/extensions/api/webstorePrivate.json4
-rw-r--r--chrome/common/extensions/api/windows.json4
-rw-r--r--chrome/common/extensions/docs/build/directory.py4
-rw-r--r--chrome/common/extensions/docs/js/api_page_generator.js4
-rw-r--r--chrome/common/extensions/docs/template/page_shell.html3
-rw-r--r--third_party/json_minify/README35
-rw-r--r--third_party/json_minify/README.chromium17
-rw-r--r--third_party/json_minify/__init__.py5
-rw-r--r--third_party/json_minify/minify-sans-regexp.js91
-rw-r--r--third_party/json_minify/minify_json.py113
-rw-r--r--tools/json_schema_compiler/compiler.py8
-rw-r--r--tools/json_schema_compiler/cpp_type_generator_test.py8
-rw-r--r--tools/json_schema_compiler/json_schema.py19
-rw-r--r--tools/json_schema_compiler/model_test.py8
-rwxr-xr-xtools/json_schema_compiler/previewserver.py8
74 files changed, 546 insertions, 21 deletions
diff --git a/chrome/common/extensions/api/bookmarks.json b/chrome/common/extensions/api/bookmarks.json
index 936bf8a..1648d41 100644
--- a/chrome/common/extensions/api/bookmarks.json
+++ b/chrome/common/extensions/api/bookmarks.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "bookmarks",
diff --git a/chrome/common/extensions/api/browserAction.json b/chrome/common/extensions/api/browserAction.json
index b051608..c6f2d6e 100644
--- a/chrome/common/extensions/api/browserAction.json
+++ b/chrome/common/extensions/api/browserAction.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "browserAction",
diff --git a/chrome/common/extensions/api/browsingData.json b/chrome/common/extensions/api/browsingData.json
index d077277..8848f6e 100644
--- a/chrome/common/extensions/api/browsingData.json
+++ b/chrome/common/extensions/api/browsingData.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "browsingData",
diff --git a/chrome/common/extensions/api/chromeAuthPrivate.json b/chrome/common/extensions/api/chromeAuthPrivate.json
index 92b3550..9f29fe7 100644
--- a/chrome/common/extensions/api/chromeAuthPrivate.json
+++ b/chrome/common/extensions/api/chromeAuthPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "chromeAuthPrivate",
diff --git a/chrome/common/extensions/api/chromePrivate.json b/chrome/common/extensions/api/chromePrivate.json
index 0cb05ac..d5b4168 100644
--- a/chrome/common/extensions/api/chromePrivate.json
+++ b/chrome/common/extensions/api/chromePrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "chromePrivate",
diff --git a/chrome/common/extensions/api/chromeosInfoPrivate.json b/chrome/common/extensions/api/chromeosInfoPrivate.json
index 0779ef72..e2cd008 100644
--- a/chrome/common/extensions/api/chromeosInfoPrivate.json
+++ b/chrome/common/extensions/api/chromeosInfoPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "chromeosInfoPrivate",
diff --git a/chrome/common/extensions/api/contentSettings.json b/chrome/common/extensions/api/contentSettings.json
index 74396bf..2d6e803 100644
--- a/chrome/common/extensions/api/contentSettings.json
+++ b/chrome/common/extensions/api/contentSettings.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "contentSettings",
diff --git a/chrome/common/extensions/api/contextMenus.json b/chrome/common/extensions/api/contextMenus.json
index aa60918..aa38a6f 100644
--- a/chrome/common/extensions/api/contextMenus.json
+++ b/chrome/common/extensions/api/contextMenus.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "contextMenus",
diff --git a/chrome/common/extensions/api/cookies.json b/chrome/common/extensions/api/cookies.json
index d70afa8..fd3a633 100644
--- a/chrome/common/extensions/api/cookies.json
+++ b/chrome/common/extensions/api/cookies.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "cookies",
diff --git a/chrome/common/extensions/api/debugger.json b/chrome/common/extensions/api/debugger.json
index 5642b14..c34e41c 100644
--- a/chrome/common/extensions/api/debugger.json
+++ b/chrome/common/extensions/api/debugger.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "debugger",
diff --git a/chrome/common/extensions/api/devtools.json b/chrome/common/extensions/api/devtools.json
index a37576c..4a6d9df 100644
--- a/chrome/common/extensions/api/devtools.json
+++ b/chrome/common/extensions/api/devtools.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "devtools",
diff --git a/chrome/common/extensions/api/devtools_api.json b/chrome/common/extensions/api/devtools_api.json
index 591cdfb..4d21eed 100644
--- a/chrome/common/extensions/api/devtools_api.json
+++ b/chrome/common/extensions/api/devtools_api.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "devtools.inspectedWindow",
diff --git a/chrome/common/extensions/api/experimental.accessibility.json b/chrome/common/extensions/api/experimental.accessibility.json
index 5cc2ae6..23b785a 100644
--- a/chrome/common/extensions/api/experimental.accessibility.json
+++ b/chrome/common/extensions/api/experimental.accessibility.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.accessibility",
diff --git a/chrome/common/extensions/api/experimental.app.json b/chrome/common/extensions/api/experimental.app.json
index e410d97..a8cdc07 100644
--- a/chrome/common/extensions/api/experimental.app.json
+++ b/chrome/common/extensions/api/experimental.app.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace":"experimental.app",
diff --git a/chrome/common/extensions/api/experimental.bookmarkManager.json b/chrome/common/extensions/api/experimental.bookmarkManager.json
index 48dae6e..9d130c8 100644
--- a/chrome/common/extensions/api/experimental.bookmarkManager.json
+++ b/chrome/common/extensions/api/experimental.bookmarkManager.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.bookmarkManager",
diff --git a/chrome/common/extensions/api/experimental.declarative.json b/chrome/common/extensions/api/experimental.declarative.json
index aebed718..f75421e 100644
--- a/chrome/common/extensions/api/experimental.declarative.json
+++ b/chrome/common/extensions/api/experimental.declarative.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.declarative",
diff --git a/chrome/common/extensions/api/experimental.dns.json b/chrome/common/extensions/api/experimental.dns.json
index ea819cf..2e99d68 100644
--- a/chrome/common/extensions/api/experimental.dns.json
+++ b/chrome/common/extensions/api/experimental.dns.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.dns",
diff --git a/chrome/common/extensions/api/experimental.downloads.json b/chrome/common/extensions/api/experimental.downloads.json
index 0df9c35..7e2c8c4 100644
--- a/chrome/common/extensions/api/experimental.downloads.json
+++ b/chrome/common/extensions/api/experimental.downloads.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.downloads",
diff --git a/chrome/common/extensions/api/experimental.extension.json b/chrome/common/extensions/api/experimental.extension.json
index 907f5ff..5eae7bf 100644
--- a/chrome/common/extensions/api/experimental.extension.json
+++ b/chrome/common/extensions/api/experimental.extension.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.extension",
diff --git a/chrome/common/extensions/api/experimental.fonts.json b/chrome/common/extensions/api/experimental.fonts.json
index 13c3ff0..98ce2eb 100644
--- a/chrome/common/extensions/api/experimental.fonts.json
+++ b/chrome/common/extensions/api/experimental.fonts.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.fontSettings",
diff --git a/chrome/common/extensions/api/experimental.infobars.json b/chrome/common/extensions/api/experimental.infobars.json
index 7bffdc3..f7d797d 100644
--- a/chrome/common/extensions/api/experimental.infobars.json
+++ b/chrome/common/extensions/api/experimental.infobars.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.infobars",
diff --git a/chrome/common/extensions/api/experimental.input.ui.json b/chrome/common/extensions/api/experimental.input.ui.json
index 95db905..303d947 100644
--- a/chrome/common/extensions/api/experimental.input.ui.json
+++ b/chrome/common/extensions/api/experimental.input.ui.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.input.ui",
diff --git a/chrome/common/extensions/api/experimental.input.virtualKeyboard.json b/chrome/common/extensions/api/experimental.input.virtualKeyboard.json
index 0812017..6845d8f 100644
--- a/chrome/common/extensions/api/experimental.input.virtualKeyboard.json
+++ b/chrome/common/extensions/api/experimental.input.virtualKeyboard.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.input.virtualKeyboard",
diff --git a/chrome/common/extensions/api/experimental.keybinding.json b/chrome/common/extensions/api/experimental.keybinding.json
index 93a314e..3816cbb 100644
--- a/chrome/common/extensions/api/experimental.keybinding.json
+++ b/chrome/common/extensions/api/experimental.keybinding.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.keybinding",
diff --git a/chrome/common/extensions/api/experimental.processes.json b/chrome/common/extensions/api/experimental.processes.json
index b2f36f3..be7cf52 100644
--- a/chrome/common/extensions/api/experimental.processes.json
+++ b/chrome/common/extensions/api/experimental.processes.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.processes",
diff --git a/chrome/common/extensions/api/experimental.rlz.json b/chrome/common/extensions/api/experimental.rlz.json
index 56f1f1c..b954a4e 100644
--- a/chrome/common/extensions/api/experimental.rlz.json
+++ b/chrome/common/extensions/api/experimental.rlz.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.rlz",
diff --git a/chrome/common/extensions/api/experimental.serial.json b/chrome/common/extensions/api/experimental.serial.json
index f5a225d..579fa18f 100644
--- a/chrome/common/extensions/api/experimental.serial.json
+++ b/chrome/common/extensions/api/experimental.serial.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.serial",
diff --git a/chrome/common/extensions/api/experimental.socket.json b/chrome/common/extensions/api/experimental.socket.json
index 2cbd770..0a66f2f 100644
--- a/chrome/common/extensions/api/experimental.socket.json
+++ b/chrome/common/extensions/api/experimental.socket.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.socket",
diff --git a/chrome/common/extensions/api/experimental.speechInput.json b/chrome/common/extensions/api/experimental.speechInput.json
index 1c7f610..280eb9d 100644
--- a/chrome/common/extensions/api/experimental.speechInput.json
+++ b/chrome/common/extensions/api/experimental.speechInput.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.speechInput",
diff --git a/chrome/common/extensions/api/experimental.topSites.json b/chrome/common/extensions/api/experimental.topSites.json
index 2ff669b..6f247e7 100644
--- a/chrome/common/extensions/api/experimental.topSites.json
+++ b/chrome/common/extensions/api/experimental.topSites.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "experimental.topSites",
diff --git a/chrome/common/extensions/api/extension.json b/chrome/common/extensions/api/extension.json
index 5aca5e4..b059a7a 100644
--- a/chrome/common/extensions/api/extension.json
+++ b/chrome/common/extensions/api/extension.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "extension",
diff --git a/chrome/common/extensions/api/fileBrowserHandler.json b/chrome/common/extensions/api/fileBrowserHandler.json
index 4dce39e..32d54d7 100644
--- a/chrome/common/extensions/api/fileBrowserHandler.json
+++ b/chrome/common/extensions/api/fileBrowserHandler.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace":"fileBrowserHandler",
diff --git a/chrome/common/extensions/api/fileBrowserPrivate.json b/chrome/common/extensions/api/fileBrowserPrivate.json
index add4faf..e5b1d8a 100644
--- a/chrome/common/extensions/api/fileBrowserPrivate.json
+++ b/chrome/common/extensions/api/fileBrowserPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace":"fileBrowserPrivate",
diff --git a/chrome/common/extensions/api/history.json b/chrome/common/extensions/api/history.json
index 0009891..c2c0e62 100644
--- a/chrome/common/extensions/api/history.json
+++ b/chrome/common/extensions/api/history.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "history",
diff --git a/chrome/common/extensions/api/i18n.json b/chrome/common/extensions/api/i18n.json
index 6b0a522..ca3b81a 100644
--- a/chrome/common/extensions/api/i18n.json
+++ b/chrome/common/extensions/api/i18n.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "i18n",
diff --git a/chrome/common/extensions/api/idle.json b/chrome/common/extensions/api/idle.json
index ccce790b..03ad9af4 100644
--- a/chrome/common/extensions/api/idle.json
+++ b/chrome/common/extensions/api/idle.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "idle",
diff --git a/chrome/common/extensions/api/input.ime.json b/chrome/common/extensions/api/input.ime.json
index 8227c02..9ddcea8 100644
--- a/chrome/common/extensions/api/input.ime.json
+++ b/chrome/common/extensions/api/input.ime.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "input.ime",
diff --git a/chrome/common/extensions/api/inputMethodPrivate.json b/chrome/common/extensions/api/inputMethodPrivate.json
index 8e8a826..6c44192 100644
--- a/chrome/common/extensions/api/inputMethodPrivate.json
+++ b/chrome/common/extensions/api/inputMethodPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "inputMethodPrivate",
diff --git a/chrome/common/extensions/api/management.json b/chrome/common/extensions/api/management.json
index 59408df..6661c85 100644
--- a/chrome/common/extensions/api/management.json
+++ b/chrome/common/extensions/api/management.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace":"management",
diff --git a/chrome/common/extensions/api/mediaPlayerPrivate.json b/chrome/common/extensions/api/mediaPlayerPrivate.json
index d7b4ea0..fef30a0 100644
--- a/chrome/common/extensions/api/mediaPlayerPrivate.json
+++ b/chrome/common/extensions/api/mediaPlayerPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "mediaPlayerPrivate",
diff --git a/chrome/common/extensions/api/metricsPrivate.json b/chrome/common/extensions/api/metricsPrivate.json
index 6de64f2..0113563 100644
--- a/chrome/common/extensions/api/metricsPrivate.json
+++ b/chrome/common/extensions/api/metricsPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "metricsPrivate",
diff --git a/chrome/common/extensions/api/omnibox.json b/chrome/common/extensions/api/omnibox.json
index 9b4f66f..bcad742 100644
--- a/chrome/common/extensions/api/omnibox.json
+++ b/chrome/common/extensions/api/omnibox.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "omnibox",
diff --git a/chrome/common/extensions/api/pageAction.json b/chrome/common/extensions/api/pageAction.json
index e07f029..9446006 100644
--- a/chrome/common/extensions/api/pageAction.json
+++ b/chrome/common/extensions/api/pageAction.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "pageAction",
diff --git a/chrome/common/extensions/api/pageActions.json b/chrome/common/extensions/api/pageActions.json
index 69e5078..7283439 100644
--- a/chrome/common/extensions/api/pageActions.json
+++ b/chrome/common/extensions/api/pageActions.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "pageActions",
diff --git a/chrome/common/extensions/api/pageCapture.json b/chrome/common/extensions/api/pageCapture.json
index 13a531e..5b8fe85 100644
--- a/chrome/common/extensions/api/pageCapture.json
+++ b/chrome/common/extensions/api/pageCapture.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "pageCapture",
diff --git a/chrome/common/extensions/api/permissions.json b/chrome/common/extensions/api/permissions.json
index 377a43f..4f4b362 100644
--- a/chrome/common/extensions/api/permissions.json
+++ b/chrome/common/extensions/api/permissions.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "permissions",
diff --git a/chrome/common/extensions/api/privacy.json b/chrome/common/extensions/api/privacy.json
index 00e8b46..ea0f9aa 100644
--- a/chrome/common/extensions/api/privacy.json
+++ b/chrome/common/extensions/api/privacy.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "privacy",
diff --git a/chrome/common/extensions/api/proxy.json b/chrome/common/extensions/api/proxy.json
index 1b6065a..ef8d38a 100644
--- a/chrome/common/extensions/api/proxy.json
+++ b/chrome/common/extensions/api/proxy.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "proxy",
diff --git a/chrome/common/extensions/api/storage.json b/chrome/common/extensions/api/storage.json
index 7165941..b3a7e98 100644
--- a/chrome/common/extensions/api/storage.json
+++ b/chrome/common/extensions/api/storage.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "storage",
diff --git a/chrome/common/extensions/api/systemPrivate.json b/chrome/common/extensions/api/systemPrivate.json
index 7214419..ec6cc53 100644
--- a/chrome/common/extensions/api/systemPrivate.json
+++ b/chrome/common/extensions/api/systemPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "systemPrivate",
diff --git a/chrome/common/extensions/api/tabs.json b/chrome/common/extensions/api/tabs.json
index 35bffac..de8ed67 100644
--- a/chrome/common/extensions/api/tabs.json
+++ b/chrome/common/extensions/api/tabs.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "tabs",
diff --git a/chrome/common/extensions/api/terminalPrivate.json b/chrome/common/extensions/api/terminalPrivate.json
index 74d8cb6..7b8802b 100644
--- a/chrome/common/extensions/api/terminalPrivate.json
+++ b/chrome/common/extensions/api/terminalPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "terminalPrivate",
diff --git a/chrome/common/extensions/api/test.json b/chrome/common/extensions/api/test.json
index 7092bb5..929a53e 100644
--- a/chrome/common/extensions/api/test.json
+++ b/chrome/common/extensions/api/test.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "test",
diff --git a/chrome/common/extensions/api/tts.json b/chrome/common/extensions/api/tts.json
index e54844d..31e79a1 100644
--- a/chrome/common/extensions/api/tts.json
+++ b/chrome/common/extensions/api/tts.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "tts",
diff --git a/chrome/common/extensions/api/ttsEngine.json b/chrome/common/extensions/api/ttsEngine.json
index 1272beb..0fbabb9 100644
--- a/chrome/common/extensions/api/ttsEngine.json
+++ b/chrome/common/extensions/api/ttsEngine.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "ttsEngine",
diff --git a/chrome/common/extensions/api/types.json b/chrome/common/extensions/api/types.json
index ea272bc..cb52d54 100644
--- a/chrome/common/extensions/api/types.json
+++ b/chrome/common/extensions/api/types.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "types",
diff --git a/chrome/common/extensions/api/webNavigation.json b/chrome/common/extensions/api/webNavigation.json
index 35d5d50..cbfc720 100644
--- a/chrome/common/extensions/api/webNavigation.json
+++ b/chrome/common/extensions/api/webNavigation.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "webNavigation",
diff --git a/chrome/common/extensions/api/webRequest.json b/chrome/common/extensions/api/webRequest.json
index d7f90ce..efa378c 100644
--- a/chrome/common/extensions/api/webRequest.json
+++ b/chrome/common/extensions/api/webRequest.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "webRequest",
diff --git a/chrome/common/extensions/api/webSocketProxyPrivate.json b/chrome/common/extensions/api/webSocketProxyPrivate.json
index 8dfbc30..4afa792 100644
--- a/chrome/common/extensions/api/webSocketProxyPrivate.json
+++ b/chrome/common/extensions/api/webSocketProxyPrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "webSocketProxyPrivate",
diff --git a/chrome/common/extensions/api/webstorePrivate.json b/chrome/common/extensions/api/webstorePrivate.json
index 94a0697..64db63c 100644
--- a/chrome/common/extensions/api/webstorePrivate.json
+++ b/chrome/common/extensions/api/webstorePrivate.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace":"webstorePrivate",
diff --git a/chrome/common/extensions/api/windows.json b/chrome/common/extensions/api/windows.json
index 2bec764..8f520f1 100644
--- a/chrome/common/extensions/api/windows.json
+++ b/chrome/common/extensions/api/windows.json
@@ -1,3 +1,7 @@
+// Copyright (c) 2012 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.
+
[
{
"namespace": "windows",
diff --git a/chrome/common/extensions/docs/build/directory.py b/chrome/common/extensions/docs/build/directory.py
index 316e0d6..6f49bcf 100644
--- a/chrome/common/extensions/docs/build/directory.py
+++ b/chrome/common/extensions/docs/build/directory.py
@@ -12,6 +12,7 @@ import re
import hashlib
import zipfile
import simplejson as json
+import json_minify as minify
# Make sure we get consistent string sorting behavior by explicitly using the
# default C locale.
@@ -48,7 +49,8 @@ def parse_json_file(path, encoding="utf-8"):
raise Exception("Failed to read the file at %s: %s" % (path, msg))
try:
- json_obj = json.load(json_file, encoding)
+ json_str = json_file.read()
+ json_obj = json.loads(minify.json_minify(json_str), encoding)
except ValueError, msg:
raise Exception("Failed to parse JSON out of file %s: %s" % (path, msg))
finally:
diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
index 202854e..944a54b 100644
--- a/chrome/common/extensions/docs/js/api_page_generator.js
+++ b/chrome/common/extensions/docs/js/api_page_generator.js
@@ -183,7 +183,7 @@ function fetchSchema() {
schema = [];
function onSchemaContent(content) {
- schema = schema.concat(JSON.parse(content));
+ schema = schema.concat(JSON.parse(JSON.minify(content)));
if (++schemas_retrieved < schemas_to_retrieve.length)
return;
if (pageName.toLowerCase() == 'samples') {
@@ -204,7 +204,7 @@ function fetchSchema() {
function fetchSamples() {
// If we're rendering the samples directory, fetch the samples manifest.
fetchContent(SAMPLES, function(sampleManifest) {
- var data = JSON.parse(sampleManifest);
+ var data = JSON.parse(JSON.minify(sampleManifest));
samples = data.samples;
apiMapping = data.api;
renderTemplate();
diff --git a/chrome/common/extensions/docs/template/page_shell.html b/chrome/common/extensions/docs/template/page_shell.html
index fdca7c6..2aaf387 100644
--- a/chrome/common/extensions/docs/template/page_shell.html
+++ b/chrome/common/extensions/docs/template/page_shell.html
@@ -17,6 +17,9 @@
<script type="text/javascript"
src="../../../third_party/jstemplate/jstemplate_compiled.js">
</script>
+ <script type="text/javascript"
+ src="../../../../third_party/json_minify/minify-sans-regexp.js">
+ </script>
<script type="text/javascript" src="js/api_page_generator.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/sidebar.js"></script>
diff --git a/third_party/json_minify/README b/third_party/json_minify/README
new file mode 100644
index 0000000..98406f2
--- /dev/null
+++ b/third_party/json_minify/README
@@ -0,0 +1,35 @@
+/*! JSON.minify()
+ v0.1 (c) Kyle Simpson
+ MIT License
+*/
+
+JSON.minify() minifies blocks of JSON-like content into valid JSON by removing all
+whitespace *and* comments.
+
+JSON parsers (like JavaScript's JSON.parse() parser) generally don't consider JSON
+with comments to be valid and parseable. So, the intended usage is to minify
+development-friendly JSON (with comments) to valid JSON before parsing, such as:
+
+JSON.parse(JSON.minify(str));
+
+Now you can maintain development-friendly JSON documents, but minify them before
+parsing or before transmitting them over-the-wire.
+
+Though comments are not officially part of the JSON standard, this post from
+Douglas Crockford back in late 2005 helps explain the motivation behind this project.
+
+http://tech.groups.yahoo.com/group/json/message/152
+
+"A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore comments."
+
+Basically, comments are not in the JSON *generation* standard, but that doesn't mean
+that a parser can't be taught to ignore them. Which is exactly what JSON.minify()
+is for.
+
+The first implementation of JSON.minify() is in JavaScript, but the intent is to
+port the implementation to as many other environments as possible/practical.
+
+NOTE: As transmitting bloated (ie, with comments/whitespace) JSON would be wasteful
+and silly, this JSON.minify() is intended for use in server-side processing
+environments where you can strip comments/whitespace from JSON before parsing
+a JSON document, or before transmitting such over-the-wire from server to browser. \ No newline at end of file
diff --git a/third_party/json_minify/README.chromium b/third_party/json_minify/README.chromium
new file mode 100644
index 0000000..0f5f630
--- /dev/null
+++ b/third_party/json_minify/README.chromium
@@ -0,0 +1,17 @@
+Name: JSON.minify
+URL: https://github.com/getify/JSON.minify
+and also https://github.com/kitcambridge/JSON.minify
+Version: 0.1
+License: MIT License
+License file: https://github.com/getify/JSON.minify/blob/master/README.txt
+(README has license info)
+Security Critical: no
+
+Description:
+A set of scripts that remove comments and whitespace from JSON files.
+
+Local Modifications:
+- Added the __init__.py file for easier imports
+- Got the (much faster) json-minify-sans-regexp.js file from the second
+ URL listed
+- Small change to minify_json.py to pass license tests
diff --git a/third_party/json_minify/__init__.py b/third_party/json_minify/__init__.py
new file mode 100644
index 0000000..45bce20
--- /dev/null
+++ b/third_party/json_minify/__init__.py
@@ -0,0 +1,5 @@
+# Copyright (c) 2012 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.
+
+from minify_json import json_minify
diff --git a/third_party/json_minify/minify-sans-regexp.js b/third_party/json_minify/minify-sans-regexp.js
new file mode 100644
index 0000000..99c817c
--- /dev/null
+++ b/third_party/json_minify/minify-sans-regexp.js
@@ -0,0 +1,91 @@
+/*!
+ * `JSON.minify()`
+ * This version does not use regular expressions.
+ *
+ * Copyright 2011, Kyle Simpson.
+ * Copyright 2012, Kit Cambridge.
+ *
+ * Released under the MIT License.
+*/
+
+;(function () {
+ var JSON = this.JSON;
+
+ // Create the global JSON object if it doesn't exist.
+ if (Object(JSON) !== JSON) {
+ JSON = this.JSON = {};
+ }
+
+ JSON.minify = function (source) {
+ var index = 0, length = source.length, result = "", symbol, position;
+ while (index < length) {
+ symbol = source.charAt(index);
+ switch (symbol) {
+ // Ignore whitespace tokens. According to ES 5.1 section 15.12.1.1,
+ // whitespace tokens include tabs, carriage returns, line feeds, and
+ // space characters.
+ // -----------------------------------------------------------------
+ case "\t":
+ case "\r":
+ case "\n":
+ case " ":
+ index += 1;
+ break;
+ // Ignore line and block comments.
+ // -------------------------------
+ case "/":
+ symbol = source.charAt(index += 1);
+ switch (symbol) {
+ // Line comments.
+ // -------------
+ case "/":
+ position = source.indexOf("\n", index);
+ if (position < 0) {
+ // Check for CR-style line endings.
+ position = source.indexOf("\r", index);
+ }
+ index = position > -1 ? position : length;
+ break;
+ // Block comments.
+ // ---------------
+ case "*":
+ position = source.indexOf("*/", index);
+ if (position > -1) {
+ // Advance the scanner's position past the end of the comment.
+ index = position += 2;
+ break;
+ }
+ throw SyntaxError("Unterminated block comment.");
+ default:
+ throw SyntaxError("Invalid comment.");
+ }
+ break;
+ // Parse strings separately to ensure that any whitespace characters and
+ // JavaScript-style comments within them are preserved.
+ // ---------------------------------------------------------------------
+ case '"':
+ position = index;
+ while (index < length) {
+ symbol = source.charAt(index += 1);
+ if (symbol == "\\") {
+ // Skip past escaped characters.
+ index += 1;
+ } else if (symbol == '"') {
+ break;
+ }
+ }
+ if (source.charAt(index) == '"') {
+ result += source.slice(position, index += 1);
+ break;
+ }
+ throw SyntaxError("Unterminated string.");
+ // Preserve all other characters.
+ // ------------------------------
+ default:
+ result += symbol;
+ index += 1;
+ }
+ }
+ return result;
+ };
+}).call(this);
diff --git a/third_party/json_minify/minify_json.py b/third_party/json_minify/minify_json.py
new file mode 100644
index 0000000..69aac6e
--- /dev/null
+++ b/third_party/json_minify/minify_json.py
@@ -0,0 +1,113 @@
+# Use of this source code is governed by a BSD-style license (MIT)
+'''
+Created on 20/01/2011
+
+v0.1 (C) Gerald Storer
+MIT License
+
+Based on JSON.minify.js:
+https://github.com/getify/JSON.minify
+'''
+
+import re
+
+def json_minify(json,strip_space=True):
+ tokenizer=re.compile('"|(/\*)|(\*/)|(//)|\n|\r')
+ in_string = False
+ in_multiline_comment = False
+ in_singleline_comment = False
+
+ new_str = []
+ from_index = 0 # from is a keyword in Python
+
+ for match in re.finditer(tokenizer,json):
+
+ if not in_multiline_comment and not in_singleline_comment:
+ tmp2 = json[from_index:match.start()]
+ if not in_string and strip_space:
+ tmp2 = re.sub('[ \t\n\r]*','',tmp2) # replace only white space defined in standard
+ new_str.append(tmp2)
+
+ from_index = match.end()
+
+ if match.group() == '"' and not in_multiline_comment and not in_singleline_comment:
+ escaped = re.search('(\\\\)*$',json[:match.start()])
+ if not in_string or escaped is None or len(escaped.group()) % 2 == 0:
+ # start of string with ", or unescaped " character found to end string
+ in_string = not in_string
+ from_index -= 1 # include " character in next catch
+
+ elif match.group() == '/*' and not in_string and not in_multiline_comment and not in_singleline_comment:
+ in_multiline_comment = True
+ elif match.group() == '*/' and not in_string and in_multiline_comment and not in_singleline_comment:
+ in_multiline_comment = False
+ elif match.group() == '//' and not in_string and not in_multiline_comment and not in_singleline_comment:
+ in_singleline_comment = True
+ elif (match.group() == '\n' or match.group() == '\r') and not in_string and not in_multiline_comment and in_singleline_comment:
+ in_singleline_comment = False
+ elif not in_multiline_comment and not in_singleline_comment and (
+ match.group() not in ['\n','\r',' ','\t'] or not strip_space):
+ new_str.append(match.group())
+
+ new_str.append(json[from_index:])
+ return ''.join(new_str)
+
+if __name__ == '__main__':
+ import json # requires Python 2.6+ to run tests
+
+ def test_json(s):
+ return json.loads(json_minify(s))
+
+ test1 = '''// this is a JSON file with comments
+{
+ "foo": "bar", // this is cool
+ "bar": [
+ "baz", "bum", "zam"
+ ],
+/* the rest of this document is just fluff
+ in case you are interested. */
+ "something": 10,
+ "else": 20
+}
+
+/* NOTE: You can easily strip the whitespace and comments
+ from such a file with the JSON.minify() project hosted
+ here on github at http://github.com/getify/JSON.minify
+*/
+'''
+
+ test1_res = '''{"foo":"bar","bar":["baz","bum","zam"],"something":10,"else":20}'''
+
+ test2 = '''
+{"/*":"*/","//":"",/*"//"*/"/*/"://
+"//"}
+
+'''
+ test2_res = '''{"/*":"*/","//":"","/*/":"//"}'''
+
+ test3 = r'''/*
+this is a
+multi line comment */{
+
+"foo"
+:
+ "bar/*"// something
+ , "b\"az":/*
+something else */"blah"
+
+}
+'''
+ test3_res = r'''{"foo":"bar/*","b\"az":"blah"}'''
+
+ test4 = r'''{"foo": "ba\"r//", "bar\\": "b\\\"a/*z",
+ "baz\\\\": /* yay */ "fo\\\\\"*/o"
+}
+'''
+ test4_res = r'''{"foo":"ba\"r//","bar\\":"b\\\"a/*z","baz\\\\":"fo\\\\\"*/o"}'''
+
+ assert test_json(test1) == json.loads(test1_res),'Failed test 1'
+ assert test_json(test2) == json.loads(test2_res),'Failed test 2'
+ assert test_json(test3) == json.loads(test3_res),'Failed test 3'
+ assert test_json(test4) == json.loads(test4_res),'Failed test 4'
+ if __debug__: # Don't print passed message if the asserts didn't run
+ print 'Passed all tests'
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index 54ab62f..fb84a6c 100644
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -19,7 +19,7 @@ Usage example:
import cc_generator
import cpp_type_generator
import h_generator
-import json
+from json_schema import LoadJSON
import model
import optparse
import os.path
@@ -49,8 +49,7 @@ if __name__ == '__main__':
# Actually generate for source file.
- with open(schema, 'r') as schema_file:
- api_defs = json.loads(schema_file.read())
+ api_defs = LoadJSON(schema)
for target_namespace in api_defs:
referenced_schemas = target_namespace.get('dependencies', [])
@@ -58,8 +57,7 @@ if __name__ == '__main__':
for referenced_schema in referenced_schemas:
referenced_schema_path = os.path.join(
os.path.dirname(schema), referenced_schema + '.json')
- with open(referenced_schema_path, 'r') as referenced_schema_file:
- referenced_api_defs = json.loads(referenced_schema_file.read())
+ referenced_api_defs = LoadJSON(referenced_schema_path)
for namespace in referenced_api_defs:
api_model.AddNamespace(namespace,
diff --git a/tools/json_schema_compiler/cpp_type_generator_test.py b/tools/json_schema_compiler/cpp_type_generator_test.py
index ac16262..e58dbac 100644
--- a/tools/json_schema_compiler/cpp_type_generator_test.py
+++ b/tools/json_schema_compiler/cpp_type_generator_test.py
@@ -3,22 +3,22 @@
# found in the LICENSE file.
from cpp_type_generator import CppTypeGenerator
-import json
+from json_schema import LoadJSON
import model
import unittest
class CppTypeGeneratorTest(unittest.TestCase):
def setUp(self):
self.model = model.Model()
- self.permissions_json = json.loads(open('test/permissions.json').read())
+ self.permissions_json = LoadJSON('test/permissions.json')
self.model.AddNamespace(self.permissions_json[0],
'path/to/permissions.json')
self.permissions = self.model.namespaces.get('permissions')
- self.windows_json = json.loads(open('test/windows.json').read())
+ self.windows_json = LoadJSON('test/windows.json')
self.model.AddNamespace(self.windows_json[0],
'path/to/window.json')
self.windows = self.model.namespaces.get('windows')
- self.tabs_json = json.loads(open('test/tabs.json').read())
+ self.tabs_json = LoadJSON('test/tabs.json')
self.model.AddNamespace(self.tabs_json[0],
'path/to/tabs.json')
self.tabs = self.model.namespaces.get('tabs')
diff --git a/tools/json_schema_compiler/json_schema.py b/tools/json_schema_compiler/json_schema.py
new file mode 100644
index 0000000..aa192c0
--- /dev/null
+++ b/tools/json_schema_compiler/json_schema.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2012 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.
+
+import json
+import os.path
+import sys
+
+# We need to get json_minify from the third_party directory.
+# This is similar to what is done in chrome/common/extensions/docs/build.py
+third_party_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ os.pardir, os.pardir, 'third_party/')
+if third_party_path not in sys.path:
+ sys.path.insert(0, third_party_path)
+import json_minify as minify
+
+def LoadJSON(filename):
+ with open(filename, 'r') as handle:
+ return json.loads(minify.json_minify(handle.read()))
diff --git a/tools/json_schema_compiler/model_test.py b/tools/json_schema_compiler/model_test.py
index 3217498..a588968 100644
--- a/tools/json_schema_compiler/model_test.py
+++ b/tools/json_schema_compiler/model_test.py
@@ -2,22 +2,22 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import json
+from json_schema import LoadJSON
import model
import unittest
class ModelTest(unittest.TestCase):
def setUp(self):
self.model = model.Model()
- self.permissions_json = json.loads(open('test/permissions.json').read())
+ self.permissions_json = LoadJSON('test/permissions.json')
self.model.AddNamespace(self.permissions_json[0],
'path/to/permissions.json')
self.permissions = self.model.namespaces.get('permissions')
- self.windows_json = json.loads(open('test/windows.json').read())
+ self.windows_json = LoadJSON('test/windows.json')
self.model.AddNamespace(self.windows_json[0],
'path/to/window.json')
self.windows = self.model.namespaces.get('windows')
- self.tabs_json = json.loads(open('test/tabs.json').read())
+ self.tabs_json = LoadJSON('test/tabs.json')
self.model.AddNamespace(self.tabs_json[0],
'path/to/tabs.json')
self.tabs = self.model.namespaces.get('tabs')
diff --git a/tools/json_schema_compiler/previewserver.py b/tools/json_schema_compiler/previewserver.py
index 384171e..8a6f6ab 100755
--- a/tools/json_schema_compiler/previewserver.py
+++ b/tools/json_schema_compiler/previewserver.py
@@ -11,7 +11,7 @@ import code
import cpp_type_generator
import cpp_util
import h_generator
-import json
+from json_schema import LoadJSON
import model
import optparse
import os
@@ -188,8 +188,7 @@ updateEverything();
try:
# Get main json file
- with open(json_file_path) as json_file:
- api_defs = json.loads(json_file.read())
+ api_defs = LoadJSON(json_file_path)
namespace = api_model.AddNamespace(api_defs[0], json_file_path)
if not namespace:
body.Append("<pre>Target file %s is marked nocompile</pre>" %
@@ -201,8 +200,7 @@ updateEverything();
# Get json file depedencies
for dependency in api_defs[0].get('dependencies', []):
json_file_path = os.path.join(filedir, dependency + '.json')
- with open(json_file_path) as json_file:
- api_defs = json.loads(json_file.read())
+ api_defs = LoadJSON(json_file_path)
referenced_namespace = api_model.AddNamespace(api_defs[0],
json_file_path)
if referenced_namespace: