Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/renderer/extensions/schema_generated_native_handler.h" | |
| 6 | |
| 7 #include "chrome/renderer/extensions/module_system.h" | |
| 8 #include "chrome/renderer/extensions/v8_schema_registry.h" | |
| 9 | |
| 10 namespace extensions { | |
| 11 | |
| 12 SchemaGeneratedNativeHandler::SchemaGeneratedNativeHandler( | |
| 13 ModuleSystem* module_system, | |
| 14 V8SchemaRegistry* schema_registry, | |
| 15 const std::string& api_name, | |
| 16 const std::string& bind_to) | |
| 17 : module_system_(module_system), | |
| 18 schema_registry_(schema_registry), | |
| 19 api_name_(api_name), | |
| 20 bind_to_(bind_to) { | |
| 21 } | |
| 22 | |
| 23 v8::Handle<v8::Object> SchemaGeneratedNativeHandler::NewInstance() { | |
| 24 v8::Handle<v8::Object> schema = schema_registry_->GetSchema(api_name_); | |
| 25 v8::Handle<v8::Value> module = | |
| 26 module_system_->Require("schema_generated_bindings"); | |
| 27 v8::Local<v8::Value> func = | |
| 28 v8::Handle<v8::Object>::Cast(module)->Get( | |
| 29 v8::String::New("compile")); | |
| 30 | |
| 31 v8::Handle<v8::Value> argv[] = { schema }; | |
| 32 v8::Handle<v8::Value> compiled_schema = | |
| 33 module_system_->CallModuleMethod(func, 1, argv); | |
| 34 object_template_->Set(bind_to_.c_str(), compiled_schema); | |
| 35 LOG(ERROR) << "CALLING NEW INSTANCE"; | |
| 36 return object_template_->NewInstance(); | |
|
not at google - send to devlin
2012/12/14 00:44:00
I think you can just construct a new object, no ne
cduvall
2012/12/14 02:04:50
I agree, I'll do it once I get some other stuff fi
| |
| 37 } | |
| 38 | |
| 39 } // extensions | |
| OLD | NEW |