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 | |
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')
8 files changed, 18 insertions, 15 deletions
diff --git a/extensions/shell/browser/shell_display_info_provider.cc b/extensions/shell/browser/shell_display_info_provider.cc index 1666136..32239ab 100644 --- a/extensions/shell/browser/shell_display_info_provider.cc +++ b/extensions/shell/browser/shell_display_info_provider.cc @@ -14,7 +14,7 @@ ShellDisplayInfoProvider::~ShellDisplayInfoProvider() { bool ShellDisplayInfoProvider::SetInfo( const std::string& display_id, - const core_api::system_display::DisplayProperties& info, + const api::system_display::DisplayProperties& info, std::string* error) { *error = "Not implemented"; return false; @@ -22,7 +22,7 @@ bool ShellDisplayInfoProvider::SetInfo( void ShellDisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, - extensions::core_api::system_display::DisplayUnitInfo* unit) { + extensions::api::system_display::DisplayUnitInfo* unit) { static bool logged_once = false; if (!logged_once) { NOTIMPLEMENTED(); diff --git a/extensions/shell/browser/shell_display_info_provider.h b/extensions/shell/browser/shell_display_info_provider.h index 61cea1c..52c8576 100644 --- a/extensions/shell/browser/shell_display_info_provider.h +++ b/extensions/shell/browser/shell_display_info_provider.h @@ -16,11 +16,11 @@ class ShellDisplayInfoProvider : public DisplayInfoProvider { // DisplayInfoProvider implementation. bool SetInfo(const std::string& display_id, - const core_api::system_display::DisplayProperties& info, + const api::system_display::DisplayProperties& info, std::string* error) override; void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, - extensions::core_api::system_display::DisplayUnitInfo* unit) override; + extensions::api::system_display::DisplayUnitInfo* unit) override; gfx::Screen* GetActiveScreen() override; private: diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index df0f872..6fc34e8 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc @@ -178,10 +178,10 @@ ShellExtensionsBrowserClient::GetExtensionSystemFactory() { void ShellExtensionsBrowserClient::RegisterExtensionFunctions( ExtensionFunctionRegistry* registry) const { // Register core extension-system APIs. - core_api::GeneratedFunctionRegistry::RegisterAll(registry); + api::GeneratedFunctionRegistry::RegisterAll(registry); // app_shell-only APIs. - shell::api::GeneratedFunctionRegistry::RegisterAll(registry); + shell::api::ShellGeneratedFunctionRegistry::RegisterAll(registry); } void ShellExtensionsBrowserClient::RegisterMojoServices( diff --git a/extensions/shell/browser/shell_runtime_api_delegate.cc b/extensions/shell/browser/shell_runtime_api_delegate.cc index 668fcce..77dacab 100644 --- a/extensions/shell/browser/shell_runtime_api_delegate.cc +++ b/extensions/shell/browser/shell_runtime_api_delegate.cc @@ -11,7 +11,7 @@ #include "chromeos/dbus/power_manager_client.h" #endif -using extensions::core_api::runtime::PlatformInfo; +using extensions::api::runtime::PlatformInfo; namespace extensions { @@ -46,9 +46,9 @@ void ShellRuntimeAPIDelegate::OpenURL(const GURL& uninstall_url) { bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) { #if defined(OS_CHROMEOS) - info->os = core_api::runtime::PLATFORM_OS_CROS; + info->os = api::runtime::PLATFORM_OS_CROS; #elif defined(OS_LINUX) - info->os = core_api::runtime::PLATFORM_OS_LINUX; + info->os = api::runtime::PLATFORM_OS_LINUX; #endif return true; } diff --git a/extensions/shell/browser/shell_runtime_api_delegate.h b/extensions/shell/browser/shell_runtime_api_delegate.h index 816423b..f0a8d38 100644 --- a/extensions/shell/browser/shell_runtime_api_delegate.h +++ b/extensions/shell/browser/shell_runtime_api_delegate.h @@ -24,7 +24,7 @@ class ShellRuntimeAPIDelegate : public RuntimeAPIDelegate { bool CheckForUpdates(const std::string& extension_id, const UpdateCheckCallback& callback) override; void OpenURL(const GURL& uninstall_url) override; - bool GetPlatformInfo(core_api::runtime::PlatformInfo* info) override; + bool GetPlatformInfo(api::runtime::PlatformInfo* info) override; bool RestartDevice(std::string* error_message) override; private: 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( |