| Index: extensions/renderer/native_extension_bindings_system.cc
|
| diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc
|
| index cd6ec5179ca4f6353f450a85bbba92a20b6aaeaa..3e98b9c9d8a442cf3e5683beac83ff7ec372ec98 100644
|
| --- a/extensions/renderer/native_extension_bindings_system.cc
|
| +++ b/extensions/renderer/native_extension_bindings_system.cc
|
| @@ -184,11 +184,14 @@ const base::DictionaryValue& GetAPISchema(const std::string& api_name) {
|
| return *schema;
|
| }
|
|
|
| -// Returns true if the method specified by |method_name| is available to the
|
| -// given |context|.
|
| -bool IsAPIMethodAvailable(ScriptContext* context,
|
| - const std::string& method_name) {
|
| - return context->GetAvailability(method_name).is_available();
|
| +// Returns true if the feature specified by |name| is available to the given
|
| +// |context|.
|
| +bool IsAPIFeatureAvailable(v8::Local<v8::Context> context,
|
| + const std::string& name) {
|
| + ScriptContext* script_context =
|
| + ScriptContextSet::GetContextByV8Context(context);
|
| + DCHECK(script_context);
|
| + return script_context->GetAvailability(name).is_available();
|
| }
|
|
|
| // Instantiates the binding object for the given |name|. |name| must specify a
|
| @@ -198,8 +201,8 @@ v8::Local<v8::Object> CreateRootBinding(v8::Local<v8::Context> context,
|
| const std::string& name,
|
| APIBindingsSystem* bindings_system) {
|
| APIBindingHooks* hooks = nullptr;
|
| - v8::Local<v8::Object> binding_object = bindings_system->CreateAPIInstance(
|
| - name, context, base::Bind(&IsAPIMethodAvailable, script_context), &hooks);
|
| + v8::Local<v8::Object> binding_object =
|
| + bindings_system->CreateAPIInstance(name, context, &hooks);
|
|
|
| gin::Handle<APIBindingBridge> bridge_handle = gin::CreateHandle(
|
| context->GetIsolate(),
|
| @@ -342,6 +345,7 @@ NativeExtensionBindingsSystem::NativeExtensionBindingsSystem(
|
| base::Bind(&CallJsFunction),
|
| base::Bind(&CallJsFunctionSync),
|
| base::Bind(&GetAPISchema),
|
| + base::Bind(&IsAPIFeatureAvailable),
|
| base::Bind(&NativeExtensionBindingsSystem::SendRequest,
|
| base::Unretained(this)),
|
| base::Bind(&NativeExtensionBindingsSystem::OnEventListenerChanged,
|
|
|