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

Side by Side Diff: chrome/renderer/extensions/schema_generated_native_handler.cc

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments/TODOs Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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::Value> module =
not at google - send to devlin 2013/01/25 00:44:31 schema_binding_generator
cduvall 2013/02/12 02:13:47 Done.
25 module_system_->Require("schema_binding_generator");
26 v8::Local<v8::Value> func =
not at google - send to devlin 2013/01/25 00:44:31 generate
cduvall 2013/02/12 02:13:47 Done.
27 v8::Handle<v8::Object>::Cast(module)->Get(
28 v8::String::New("generate"));
29
30 v8::Handle<v8::Value> argv[] = {
31 schema_registry_->GetSchema(api_name_)
32 };
not at google - send to devlin 2013/01/25 00:44:31 Ok now I see why you need the "generate" function
cduvall 2013/02/12 02:13:47 Done.
33 v8::Handle<v8::Value> compiled_schema =
34 module_system_->CallModuleMethod(func, 1, argv);
35 v8::Handle<v8::Object> object = v8::Object::New();
36 object->Set(v8::String::New(bind_to_.c_str()), compiled_schema);
37 return object;
38 }
39
40 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698