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

Unified Diff: extensions/renderer/api_binding.h

Issue 2891123002: [Extensions Bindings] Handle updating context permissions (Closed)
Patch Set: jbroman's Created 3 years, 7 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_binding.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_binding.h
diff --git a/extensions/renderer/api_binding.h b/extensions/renderer/api_binding.h
index 8e20a97e3a550c9143dcb2bd35af8e72c1181e68..292cdf318c95bcdc2522a4b7962bc3c25ace811e 100644
--- a/extensions/renderer/api_binding.h
+++ b/extensions/renderer/api_binding.h
@@ -47,9 +47,10 @@ class APIBinding {
const std::string& property_name,
const base::ListValue* property_values)>;
- // The callback for determining if a given API method (specified by |name|)
- // is available.
- using AvailabilityCallback = base::Callback<bool(const std::string& name)>;
+ // The callback for determining if a given API feature (specified by |name|)
+ // is available in the given context.
+ using AvailabilityCallback =
+ base::Callback<bool(v8::Local<v8::Context>, const std::string& name)>;
// The callback type for handling an API call.
using HandlerCallback = base::Callback<void(gin::Arguments*)>;
@@ -63,6 +64,7 @@ class APIBinding {
const base::ListValue* event_definitions,
const base::DictionaryValue* property_definitions,
const CreateCustomType& create_custom_type,
+ const AvailabilityCallback& is_available,
std::unique_ptr<APIBindingHooks> binding_hooks,
APITypeReferenceMap* type_refs,
APIRequestHandler* request_handler,
@@ -70,9 +72,7 @@ class APIBinding {
~APIBinding();
// Returns a new v8::Object for the API this APIBinding represents.
- v8::Local<v8::Object> CreateInstance(
- v8::Local<v8::Context> context,
- const AvailabilityCallback& is_available);
+ v8::Local<v8::Object> CreateInstance(v8::Local<v8::Context> context);
APIBindingHooks* hooks() { return binding_hooks_.get(); }
@@ -130,6 +130,9 @@ class APIBinding {
// The callback for constructing a custom type.
CreateCustomType create_custom_type_;
+ // The callback for checking availability of an API feature.
+ AvailabilityCallback is_available_;
+
// The registered hooks for this API.
std::unique_ptr<APIBindingHooks> binding_hooks_;
« no previous file with comments | « no previous file | extensions/renderer/api_binding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698