diff options
author | kalman <kalman@chromium.org> | 2015-07-23 11:27:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-23 18:28:16 +0000 |
commit | e58e6223146f09405229146fce6c1bfe6b71e4ce (patch) | |
tree | 8f32850890b2057b11cfdf2bc02cdba3a12c3e1d /extensions/shell/common | |
parent | f340ae7cfdf33370ea3aed173ab2e86fe8415936 (diff) | |
download | chromium_src-e58e6223146f09405229146fce6c1bfe6b71e4ce.zip chromium_src-e58e6223146f09405229146fce6c1bfe6b71e4ce.tar.gz chromium_src-e58e6223146f09405229146fce6c1bfe6b71e4ce.tar.bz2 |
Generate all extension schema namespaces as "api" and instead vary the generated bundle names.
At the moment the 3 modules that use extension API schemas, those in
extensions/common/api, chrome/common/extensions/api, and extensions/shell/api,
are generated with different C++ namespaces: "core_api", "api", and
"shell::api" respectively.
This is a pointless distinction to make since as far as JS is concerned they
must all go on the window.chrome object, therefore namespace conflicts are
impossible. It just ends up adding code noise.
The only problem it solves is that all bundle compiles are generated to the
same name, "GeneratedSchemas" and "GeneratedFunctionRegistry". This patch
solves that a different way, by adding a JSON schema compiler option to give
those generated classes a prefix such that they are "GeneratedSchemas",
"ChromeGeneratedSchemas", and "ShellGeneratedSchemas" respectively.
This lets us to a global substitution from "core_api" to just "api".
R=rockot@chromium.org, dpranke@chromium.org
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/1226353004
Cr-Commit-Position: refs/heads/master@{#340119}
Diffstat (limited to 'extensions/shell/common')
-rw-r--r-- | extensions/shell/common/api/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/shell/common/api/schemas.gypi | 1 | ||||
-rw-r--r-- | extensions/shell/common/shell_extensions_client.cc | 10 |
3 files changed, 8 insertions, 5 deletions
diff --git a/extensions/shell/common/api/BUILD.gn b/extensions/shell/common/api/BUILD.gn index 1292765..35ed47e 100644 --- a/extensions/shell/common/api/BUILD.gn +++ b/extensions/shell/common/api/BUILD.gn @@ -9,12 +9,14 @@ import("schemas.gni") json_schema_api("api") { schemas = true bundle = true + bundle_name = "Shell" } # GYP version: extensions/shell/browser/api/api_registration.gyp:shell_api_registration json_schema_api("api_registration") { impl_dir = "//extensions/shell/browser/api" bundle_registration = true + bundle_name = "Shell" deps = [ ":api", diff --git a/extensions/shell/common/api/schemas.gypi b/extensions/shell/common/api/schemas.gypi index f257f9b..a4ffbfb 100644 --- a/extensions/shell/common/api/schemas.gypi +++ b/extensions/shell/common/api/schemas.gypi @@ -19,6 +19,7 @@ 'chromium_code': 1, 'cc_dir': 'extensions/shell/common/api', 'root_namespace': 'extensions::shell::api::%(namespace)s', + 'bundle_name': 'Shell', 'impl_dir_': 'extensions/shell/browser/api', 'conditions': [ diff --git a/extensions/shell/common/shell_extensions_client.cc b/extensions/shell/common/shell_extensions_client.cc index a26c95c..faf0027 100644 --- a/extensions/shell/common/shell_extensions_client.cc +++ b/extensions/shell/common/shell_extensions_client.cc @@ -197,18 +197,18 @@ bool ShellExtensionsClient::IsScriptableURL(const GURL& url, bool ShellExtensionsClient::IsAPISchemaGenerated( const std::string& name) const { - return core_api::GeneratedSchemas::IsGenerated(name) || - shell::api::GeneratedSchemas::IsGenerated(name); + return api::GeneratedSchemas::IsGenerated(name) || + shell::api::ShellGeneratedSchemas::IsGenerated(name); } base::StringPiece ShellExtensionsClient::GetAPISchema( const std::string& name) const { // Schema for app_shell-only APIs. - if (shell::api::GeneratedSchemas::IsGenerated(name)) - return shell::api::GeneratedSchemas::Get(name); + if (shell::api::ShellGeneratedSchemas::IsGenerated(name)) + return shell::api::ShellGeneratedSchemas::Get(name); // Core extensions APIs. - return core_api::GeneratedSchemas::Get(name); + return api::GeneratedSchemas::Get(name); } void ShellExtensionsClient::RegisterAPISchemaResources( |