diff options
author | jamescook <jamescook@chromium.org> | 2014-10-20 07:35:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 14:35:30 +0000 |
commit | 62117928b7e16e4b1080e802f26ca43f8ce1e997 (patch) | |
tree | fbedb04f41badd87a7fac3e14715e58a5c6bccdf /extensions/shell/common | |
parent | 34cb061236f5c334606379297c2dfdfded0a490e (diff) | |
download | chromium_src-62117928b7e16e4b1080e802f26ca43f8ce1e997.zip chromium_src-62117928b7e16e4b1080e802f26ca43f8ce1e997.tar.gz chromium_src-62117928b7e16e4b1080e802f26ca43f8ce1e997.tar.bz2 |
Add support for app_shell-only extension APIs
Also add a stub for an identity-related API as an example.
BUG=424651
TEST=app_shell_unittests
Review URL: https://codereview.chromium.org/660333003
Cr-Commit-Position: refs/heads/master@{#300265}
Diffstat (limited to 'extensions/shell/common')
-rw-r--r-- | extensions/shell/common/api/_api_features.json | 15 | ||||
-rw-r--r-- | extensions/shell/common/api/api.gyp | 19 | ||||
-rw-r--r-- | extensions/shell/common/api/schemas.gypi | 20 | ||||
-rw-r--r-- | extensions/shell/common/api/shell_identity.idl | 14 | ||||
-rw-r--r-- | extensions/shell/common/shell_extensions_client.cc | 11 |
5 files changed, 78 insertions, 1 deletions
diff --git a/extensions/shell/common/api/_api_features.json b/extensions/shell/common/api/_api_features.json new file mode 100644 index 0000000..b4a1376 --- /dev/null +++ b/extensions/shell/common/api/_api_features.json @@ -0,0 +1,15 @@ +// Copyright 2014 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. + +// This file defines extension APIs implemented under src/extensions/shell. +// See extensions/common/features/* to understand this file, in particular +// feature.h, simple_feature.h, and base_feature_provider.h. + +{ + "shell.identity": { + "channel": "dev", + "contexts": ["blessed_extension"], + "extension_types": ["platform_app"] + } +} diff --git a/extensions/shell/common/api/api.gyp b/extensions/shell/common/api/api.gyp new file mode 100644 index 0000000..3421f05 --- /dev/null +++ b/extensions/shell/common/api/api.gyp @@ -0,0 +1,19 @@ +# Copyright 2014 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. + +{ + 'targets': [ + { + 'target_name': 'shell_api', + 'type': 'static_library', + # TODO(jschuh): http://crbug.com/167187 size_t -> int + 'msvs_disabled_warnings': [ 4267 ], + 'includes': [ + '../../../../build/json_schema_bundle_compile.gypi', + '../../../../build/json_schema_compile.gypi', + 'schemas.gypi', + ], + }, + ], +} diff --git a/extensions/shell/common/api/schemas.gypi b/extensions/shell/common/api/schemas.gypi new file mode 100644 index 0000000..13def4f --- /dev/null +++ b/extensions/shell/common/api/schemas.gypi @@ -0,0 +1,20 @@ +# Copyright 2014 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. + +{ + 'sources': [ + '<@(schema_files)', + ], + 'variables': { + 'chromium_code': 1, + 'non_compiled_schema_files': [ + ], + 'schema_files': [ + 'shell_identity.idl', + ], + 'cc_dir': 'extensions/shell/common/api', + 'root_namespace': 'extensions::shell_api::%(namespace)s', + 'impl_dir_': 'extensions/shell/browser/api', + }, +} diff --git a/extensions/shell/common/api/shell_identity.idl b/extensions/shell/common/api/shell_identity.idl new file mode 100644 index 0000000..6772bae --- /dev/null +++ b/extensions/shell/common/api/shell_identity.idl @@ -0,0 +1,14 @@ +// Copyright 2014 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. + +// Use the <code>chrome.shell.identity</code> API to retrieve OAuth2 tokens +// for user accounts. See also <code>chrome.identity</code>. +namespace shell.identity { + + interface Functions { + // TODO(jamescook): Implement this with options and a callback. + static void getAuthToken(); + }; + +}; diff --git a/extensions/shell/common/shell_extensions_client.cc b/extensions/shell/common/shell_extensions_client.cc index f27cd09..8eae902 100644 --- a/extensions/shell/common/shell_extensions_client.cc +++ b/extensions/shell/common/shell_extensions_client.cc @@ -20,6 +20,8 @@ #include "extensions/common/permissions/permissions_info.h" #include "extensions/common/permissions/permissions_provider.h" #include "extensions/common/url_pattern_set.h" +#include "extensions/shell/common/api/generated_schemas.h" +#include "grit/app_shell_resources.h" #include "grit/extensions_resources.h" namespace extensions { @@ -127,6 +129,7 @@ ShellExtensionsClient::CreateFeatureProviderSource( new JSONFeatureProviderSource(name)); if (name == "api") { source->LoadJSON(IDR_EXTENSION_API_FEATURES); + source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES); } else if (name == "manifest") { source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); } else if (name == "permission") { @@ -171,11 +174,17 @@ bool ShellExtensionsClient::IsScriptableURL(const GURL& url, bool ShellExtensionsClient::IsAPISchemaGenerated( const std::string& name) const { - return core_api::GeneratedSchemas::IsGenerated(name); + return core_api::GeneratedSchemas::IsGenerated(name) || + shell_api::GeneratedSchemas::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); + + // Core extensions APIs. return core_api::GeneratedSchemas::Get(name); } |