blob: b49f81da41f4fdb2a737b8536172efb4f288bb91 [file] [log] [blame]
[email protected]701a94e2014-04-17 04:37:371// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]4f1633f2013-03-09 14:26:242// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]701a94e2014-04-17 04:37:375#ifndef EXTENSIONS_RENDERER_BINDING_GENERATING_NATIVE_HANDLER_H_
6#define EXTENSIONS_RENDERER_BINDING_GENERATING_NATIVE_HANDLER_H_
[email protected]4f1633f2013-03-09 14:26:247
8#include <string>
9
10#include "base/compiler_specific.h"
[email protected]b8ce52f2014-04-04 22:45:1511#include "extensions/renderer/native_handler.h"
[email protected]4f1633f2013-03-09 14:26:2412
13namespace extensions {
14
bashi61ca3c72015-06-26 00:40:1015class ScriptContext;
[email protected]4f1633f2013-03-09 14:26:2416
17// Generates API bindings based on the JSON/IDL schemas. This is done by
18// creating a |Binding| (from binding.js) for the schema and generating the
19// bindings from that.
20class BindingGeneratingNativeHandler : public NativeHandler {
21 public:
22 // Generates binding for |api_name|, and sets the |bind_to| property on the
23 // Object returned by |NewInstance| to the generated binding.
bashi61ca3c72015-06-26 00:40:1024 BindingGeneratingNativeHandler(ScriptContext* context,
[email protected]4f1633f2013-03-09 14:26:2425 const std::string& api_name,
26 const std::string& bind_to);
27
Devlin Cronind9ea8342018-01-27 06:00:0428 void Initialize() final;
Devlin Cronin6fed7f02018-01-31 22:38:2029 bool IsInitialized() final;
tfarinaf85316f2015-04-29 17:03:4030 v8::Local<v8::Object> NewInstance() override;
[email protected]4f1633f2013-03-09 14:26:2431
32 private:
bashi61ca3c72015-06-26 00:40:1033 ScriptContext* context_;
[email protected]4f1633f2013-03-09 14:26:2434 std::string api_name_;
35 std::string bind_to_;
36};
37
[email protected]b8ce52f2014-04-04 22:45:1538} // namespace extensions
[email protected]4f1633f2013-03-09 14:26:2439
[email protected]701a94e2014-04-17 04:37:3740#endif // EXTENSIONS_RENDERER_BINDING_GENERATING_NATIVE_HANDLER_H_