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

Unified Diff: extensions/renderer/api_binding.cc

Issue 2716883003: [Extensions Bindings] Store API type methods in the reference map (Closed)
Patch Set: . Created 3 years, 10 months 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 | « no previous file | extensions/renderer/api_type_reference_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_binding.cc
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc
index 7680509b5e8df7468744c6a06215b2fc953ef8bd..3ff9e2b43ed47b4595a292774b7bd67c0a5593c5 100644
--- a/extensions/renderer/api_binding.cc
+++ b/extensions/renderer/api_binding.cc
@@ -185,6 +185,23 @@ APIBinding::APIBinding(const std::string& api_name,
}
}
type_refs->AddSpec(id, std::move(argument_spec));
+ // Some types, like storage.StorageArea, have functions associated with
+ // them. Cache the function signatures in the type map.
+ const base::ListValue* type_functions = nullptr;
+ if (type_dict->GetList("functions", &type_functions)) {
+ for (const auto& func : *type_functions) {
+ const base::DictionaryValue* func_dict = nullptr;
+ CHECK(func->GetAsDictionary(&func_dict));
+ std::string function_name;
+ CHECK(func_dict->GetString("name", &function_name));
+
+ const base::ListValue* params = nullptr;
+ CHECK(func_dict->GetList("parameters", &params));
+ type_refs->AddTypeMethodSignature(
+ base::StringPrintf("%s.%s", id.c_str(), function_name.c_str()),
+ base::MakeUnique<APISignature>(*params));
+ }
+ }
}
}
« no previous file with comments | « no previous file | extensions/renderer/api_type_reference_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698