Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: extensions/renderer/script_context.cc

Issue 2494653005: Support API aliases (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/script_context.h ('k') | tools/json_schema_compiler/feature_compiler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_context.cc
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index d7acef51579bce5be606baaa09dc2fe261809aaa..77dc80cca73b0a64b7b4fd158157b5cdf7494fb7 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -221,6 +221,12 @@ void ScriptContext::SafeCallFunction(const v8::Local<v8::Function>& function,
Feature::Availability ScriptContext::GetAvailability(
const std::string& api_name) {
+ return GetAvailability(api_name, CheckAliasStatus::ALLOWED);
+}
+
+Feature::Availability ScriptContext::GetAvailability(
+ const std::string& api_name,
+ CheckAliasStatus check_alias) {
DCHECK(thread_checker_.CalledOnValidThread());
if (base::StartsWith(api_name, "test", base::CompareCase::SENSITIVE)) {
bool allowed = base::CommandLine::ForCurrentProcess()->
@@ -239,8 +245,8 @@ Feature::Availability ScriptContext::GetAvailability(
(api_name == "runtime.connect" || api_name == "runtime.sendMessage")) {
extension = NULL;
}
- return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name, extension,
- context_type_, url());
+ return ExtensionAPI::GetSharedInstance()->IsAvailable(
+ api_name, extension, context_type_, url(), check_alias);
}
void ScriptContext::DispatchEvent(const char* event_name,
@@ -265,13 +271,15 @@ std::string ScriptContext::GetEffectiveContextTypeDescription() const {
return GetContextTypeDescriptionString(effective_context_type_);
}
-bool ScriptContext::IsAnyFeatureAvailableToContext(const Feature& api) {
+bool ScriptContext::IsAnyFeatureAvailableToContext(
+ const Feature& api,
+ CheckAliasStatus check_alias) {
DCHECK(thread_checker_.CalledOnValidThread());
// TODO(lazyboy): Decide what we should do for SERVICE_WORKER_CONTEXT, where
// web_frame() is null.
GURL url = web_frame() ? GetDataSourceURLForFrame(web_frame()) : url_;
return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext(
- api, extension(), context_type(), url);
+ api, extension(), context_type(), url, check_alias);
}
// static
« no previous file with comments | « extensions/renderer/script_context.h ('k') | tools/json_schema_compiler/feature_compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698