Commit 2049a4d3 authored by Erik Chen's avatar Erik Chen Committed by Chromium LUCI CQ

Remove shell identity extension API.

The API is unused.

Change-Id: I32b21b8752234505daa52fe920e4322c8485ace1
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601047
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840902}
parent ce78d46a
......@@ -66,7 +66,6 @@ source_set("app_shell_lib") {
"//extensions/common/api",
"//extensions/renderer",
"//extensions/shell/browser/system_logs",
"//extensions/shell/common/api",
"//extensions/shell/common/api:extensions_features",
"//services/network/public/mojom",
"//third_party/blink/public:blink",
......@@ -92,8 +91,6 @@ source_set("app_shell_lib") {
"app/shell_main_delegate.h",
"browser/api/feedback_private/shell_feedback_private_delegate.cc",
"browser/api/feedback_private/shell_feedback_private_delegate.h",
"browser/api/identity/identity_api.cc",
"browser/api/identity/identity_api.h",
"browser/api/runtime/shell_runtime_api_delegate.cc",
"browser/api/runtime/shell_runtime_api_delegate.h",
"browser/default_shell_browser_main_delegate.cc",
......@@ -131,8 +128,6 @@ source_set("app_shell_lib") {
"browser/shell_extension_web_contents_observer.h",
"browser/shell_extensions_api_client.cc",
"browser/shell_extensions_api_client.h",
"browser/shell_extensions_browser_api_provider.cc",
"browser/shell_extensions_browser_api_provider.h",
"browser/shell_extensions_browser_client.cc",
"browser/shell_extensions_browser_client.h",
"browser/shell_keep_alive_requester.cc",
......@@ -293,7 +288,6 @@ test("app_shell_unittests") {
sources = [
"../test/extensions_unittests_main.cc",
"browser/api/identity/identity_api_unittest.cc",
"browser/shell_content_browser_client_unittest.cc",
"browser/shell_extension_loader_unittest.cc",
"browser/shell_keep_alive_requester_unittest.cc",
......
// 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.
#include "extensions/shell/browser/api/identity/identity_api.h"
#include "extensions/shell/common/api/identity.h"
namespace extensions {
namespace shell {
IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() =
default;
IdentityRemoveCachedAuthTokenFunction::
~IdentityRemoveCachedAuthTokenFunction() = default;
ExtensionFunction::ResponseAction IdentityRemoveCachedAuthTokenFunction::Run() {
std::unique_ptr<api::identity::RemoveCachedAuthToken::Params> params(
api::identity::RemoveCachedAuthToken::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// This stub identity API does not maintain a token cache, so there is nothing
// to remove.
return RespondNow(NoArguments());
}
} // namespace shell
} // namespace extensions
// 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.
#ifndef EXTENSIONS_SHELL_BROWSER_API_IDENTITY_IDENTITY_API_H_
#define EXTENSIONS_SHELL_BROWSER_API_IDENTITY_IDENTITY_API_H_
#include "base/macros.h"
#include "extensions/browser/extension_function.h"
namespace extensions {
namespace shell {
// Stub. See the IDL file for documentation.
class IdentityRemoveCachedAuthTokenFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("identity.removeCachedAuthToken", UNKNOWN)
IdentityRemoveCachedAuthTokenFunction();
protected:
~IdentityRemoveCachedAuthTokenFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
DISALLOW_COPY_AND_ASSIGN(IdentityRemoveCachedAuthTokenFunction);
};
} // namespace shell
} // namespace extensions
#endif // EXTENSIONS_SHELL_BROWSER_API_IDENTITY_IDENTITY_API_H_
// 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.
#include "extensions/shell/browser/api/identity/identity_api.h"
#include "base/values.h"
#include "extensions/browser/api_unittest.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"
namespace extensions {
namespace shell {
class IdentityApiTest : public ApiUnitTest {
public:
IdentityApiTest() {}
~IdentityApiTest() override {}
// testing::Test:
void SetUp() override {
ApiUnitTest::SetUp();
DictionaryBuilder oauth2;
oauth2.Set("client_id", "123456.apps.googleusercontent.com")
.Set("scopes", ListBuilder()
.Append("https://www.googleapis.com/auth/drive")
.Build());
// Create an extension with OAuth2 scopes.
set_extension(ExtensionBuilder("Test")
.SetManifestKey("oauth2", oauth2.Build())
.Build());
}
};
// Verifies that the removeCachedAuthToken function exists and can be called
// without crashing.
TEST_F(IdentityApiTest, RemoveCachedAuthToken) {
// Function succeeds and returns nothing (for its callback).
std::unique_ptr<base::Value> result = RunFunctionAndReturnValue(
new IdentityRemoveCachedAuthTokenFunction, "[{}]");
EXPECT_FALSE(result.get());
}
} // namespace shell
} // namespace extensions
// Copyright 2018 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.
#include "extensions/shell/browser/shell_extensions_browser_api_provider.h"
#include "extensions/shell/browser/api/generated_api_registration.h"
namespace extensions {
ShellExtensionsBrowserAPIProvider::ShellExtensionsBrowserAPIProvider() =
default;
ShellExtensionsBrowserAPIProvider::~ShellExtensionsBrowserAPIProvider() =
default;
void ShellExtensionsBrowserAPIProvider::RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) {
shell::api::ShellGeneratedFunctionRegistry::RegisterAll(registry);
}
} // namespace extensions
// Copyright 2018 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.
#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_API_PROVIDER_H_
#define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_API_PROVIDER_H_
#include "extensions/browser/extensions_browser_api_provider.h"
namespace extensions {
class ShellExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider {
public:
ShellExtensionsBrowserAPIProvider();
ShellExtensionsBrowserAPIProvider(const ShellExtensionsBrowserAPIProvider&) =
delete;
ShellExtensionsBrowserAPIProvider& operator=(
const ShellExtensionsBrowserAPIProvider&) = delete;
~ShellExtensionsBrowserAPIProvider() override;
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
};
} // namespace extensions
#endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_API_PROVIDER_H_
......@@ -30,7 +30,6 @@
#include "extensions/shell/browser/shell_extension_system_factory.h"
#include "extensions/shell/browser/shell_extension_web_contents_observer.h"
#include "extensions/shell/browser/shell_extensions_api_client.h"
#include "extensions/shell/browser/shell_extensions_browser_api_provider.h"
#include "extensions/shell/browser/shell_navigation_ui_data.h"
#include "services/network/public/mojom/url_loader.mojom.h"
......@@ -51,7 +50,6 @@ ShellExtensionsBrowserClient::ShellExtensionsBrowserClient()
SetCurrentChannel(version_info::Channel::UNKNOWN);
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
AddAPIProvider(std::make_unique<ShellExtensionsBrowserAPIProvider>());
}
ShellExtensionsBrowserClient::~ShellExtensionsBrowserClient() {
......
......@@ -4,38 +4,12 @@
import("//extensions/buildflags/buildflags.gni")
import("//tools/json_schema_compiler/json_features.gni")
import("//tools/json_schema_compiler/json_schema_api.gni")
assert(enable_extensions,
"Cannot depend on extensions because enable_extensions=false.")
# TODO(devlin): Enforce visibility restrictions on more of these targets?
schema_sources = [ "identity.idl" ]
root_namespace = "extensions::shell::api::%(namespace)s"
function_registration("generated_api_registration") {
sources = schema_sources
impl_dir = "//extensions/shell/browser/api"
bundle_name = "Shell"
deps = [ "//extensions/common" ]
visibility = [ ":api" ]
}
generated_json_strings("generated_api_json_strings") {
sources = schema_sources
bundle_name = "Shell"
visibility = [ ":api" ]
}
generated_types("generated_api_types") {
sources = schema_sources
visibility = [ ":api" ]
}
json_features("shell_api_features") {
feature_type = "APIFeature"
method_name = "AddShellAPIFeatures"
......@@ -44,14 +18,6 @@ json_features("shell_api_features") {
# Public Targets
group("api") {
public_deps = [
":generated_api_json_strings",
":generated_api_registration",
":generated_api_types",
]
}
group("extensions_features") {
public_deps = [
":shell_api_features",
......
......@@ -7,16 +7,10 @@
// feature.h, simple_feature.h, and feature_provider.h.
{
// Stub implementation of chrome.identity for app_shell.
"identity": {
"channel": "dev",
"contexts": ["blessed_extension"],
"extension_types": ["platform_app"]
},
// Setup related functions for a Google Cloud Devices (GCD) target device.
"shell.gcd": {
"channel": "dev",
"contexts": ["blessed_extension"],
"extension_types": ["platform_app"]
"extension_types": ["platform_app"]
}
}
// 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.
// Simplified implementation of the <code>chrome.identity</code> for app_shell.
namespace identity {
dictionary InvalidTokenDetails {
// Ignored parameter. Exists only for compatibility.
DOMString? token;
};
// Called by removeCachedAuthToken().
callback InvalidateAuthTokenCallback = void ();
interface Functions {
// Stub. Calls callback immediately because app_shell does not cache access
// tokens the way Chrome does.
static void removeCachedAuthToken(InvalidTokenDetails details,
InvalidateAuthTokenCallback callback);
};
interface Events {
// Stub. Never fired because app_shell only supports a single user account.
static void onSignInChanged(object account, boolean signedIn);
};
};
......@@ -4,8 +4,7 @@
#include "extensions/shell/common/shell_extensions_api_provider.h"
#include "extensions/common/features/json_feature_provider_source.h"
#include "extensions/shell/common/api/generated_schemas.h"
#include "base/strings/string_piece.h"
#include "extensions/shell/common/api/shell_api_features.h"
#include "extensions/shell/grit/app_shell_resources.h"
......@@ -35,16 +34,16 @@ void ShellExtensionsAPIProvider::AddBehaviorFeatures(
void ShellExtensionsAPIProvider::AddAPIJSONSources(
JSONFeatureProviderSource* json_source) {
json_source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES);
// No shell-specific APIs.
}
bool ShellExtensionsAPIProvider::IsAPISchemaGenerated(const std::string& name) {
return shell::api::ShellGeneratedSchemas::IsGenerated(name);
return false;
}
base::StringPiece ShellExtensionsAPIProvider::GetAPISchema(
const std::string& name) {
return shell::api::ShellGeneratedSchemas::Get(name);
return base::StringPiece();
}
void ShellExtensionsAPIProvider::RegisterPermissions(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment