summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-12 00:09:28 +0000
committerscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-12 00:09:28 +0000
commitb810ed751289fab5f0f0c757c46c9ab8c7a3027a (patch)
treed34f95cec4b22ea96f37d4d8cb3c8243a970b950
parenta17df8e38de1dd7ecc68f3bdf7a9c87bb2410e16 (diff)
downloadchromium_src-b810ed751289fab5f0f0c757c46c9ab8c7a3027a.zip
chromium_src-b810ed751289fab5f0f0c757c46c9ab8c7a3027a.tar.gz
chromium_src-b810ed751289fab5f0f0c757c46c9ab8c7a3027a.tar.bz2
windowCreateWindowOptions.type changed to enum; nodoc support on idl enum.
Issue 181295: chrome.app.window.CreateWindowOptions.type should be an enum. This allows runtime parameter checking to be automated, and simplifies the runtime logic check in custom code. Because this enum should not be documented, this issue is fixed: Issue 176599: JSON schema compiler supporting nodoc for enum types. idl_schema.py required detecting this property on enums. BUG=181295, 176599 TEST=http://developer.chrome.com/apps/app.window.html does not contain string 'WindowType'. Review URL: https://chromiumcodereview.appspot.com/12717005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187418 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.cc4
-rw-r--r--chrome/common/extensions/api/app_window.idl10
-rw-r--r--tools/json_schema_compiler/idl_schema.py5
-rwxr-xr-xtools/json_schema_compiler/idl_schema_test.py6
-rw-r--r--tools/json_schema_compiler/test/idl_basics.idl5
5 files changed, 21 insertions, 9 deletions
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index f0688d6..f6213be 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -34,7 +34,6 @@ const char kInvalidWindowId[] =
"The window id can not be more than 256 characters long.";
}
-const char kPanelTypeOption[] = "panel";
const char kNoneFrameOption[] = "none";
const char kHtmlFrameOption[] = "experimental-html";
@@ -172,8 +171,7 @@ bool AppWindowCreateFunction::RunImpl() {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalExtensionApis)) {
- if (options->type.get()) {
- if (*options->type == kPanelTypeOption)
+ if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) {
create_params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
}
}
diff --git a/chrome/common/extensions/api/app_window.idl b/chrome/common/extensions/api/app_window.idl
index 9983696..306fec8 100644
--- a/chrome/common/extensions/api/app_window.idl
+++ b/chrome/common/extensions/api/app_window.idl
@@ -10,6 +10,10 @@ namespace app.window {
long? height;
};
+ // 'shell' is the default window type. 'panel' is managed by the OS
+ // (Currently experimental, Ash only).
+ [nodoc] enum WindowType { shell, panel };
+
dictionary CreateWindowOptions {
// Id to identify the window. This will be used to remember the size
// and position of the window and restore that geometry when a window
@@ -56,10 +60,8 @@ namespace app.window {
// Maximum height of the window.
long? maxHeight;
- // Window type:
- // 'shell' - the default window type
- // 'panel' - a panel, managed by the OS (Currently experimental, Ash only)
- [nodoc] DOMString? type;
+ // Type of window to create.
+ [nodoc] WindowType? type;
// Frame type: 'none' or 'chrome' (defaults to 'chrome').
DOMString? frame;
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 8c1bc76..4c79c30 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -295,8 +295,9 @@ class Enum(object):
'description': self.description,
'type': 'string',
'enum': enum}
- if self.node.GetProperty('inline_doc'):
- result['inline_doc'] = True
+ for property_name in ('inline_doc', 'nodoc'):
+ if self.node.GetProperty(property_name):
+ result[property_name] = True
return result
diff --git a/tools/json_schema_compiler/idl_schema_test.py b/tools/json_schema_compiler/idl_schema_test.py
index 26a382a..6adbbd7 100755
--- a/tools/json_schema_compiler/idl_schema_test.py
+++ b/tools/json_schema_compiler/idl_schema_test.py
@@ -93,6 +93,12 @@ class IdlSchemaTest(unittest.TestCase):
self.assertTrue(func is not None)
self.assertTrue(func['nocompile'])
+ def testNoDocOnEnum(self):
+ schema = self.idl_basics
+ enum_with_nodoc = getType(schema, 'EnumTypeWithNoDoc')
+ self.assertTrue(enum_with_nodoc is not None)
+ self.assertTrue(enum_with_nodoc['nodoc'])
+
def testInternalNamespace(self):
idl_basics = self.idl_basics
self.assertEquals('idl_basics', idl_basics['namespace'])
diff --git a/tools/json_schema_compiler/test/idl_basics.idl b/tools/json_schema_compiler/test/idl_basics.idl
index 0fa9b43..08d369c 100644
--- a/tools/json_schema_compiler/test/idl_basics.idl
+++ b/tools/json_schema_compiler/test/idl_basics.idl
@@ -11,6 +11,11 @@
name2
};
+ [nodoc] enum EnumTypeWithNoDoc {
+ name1,
+ name2
+ };
+
dictionary MyType1 {
// This comment tests "double-quotes".
[legalValues=(1,2)] long x;