Use JavaScript to open the main window.

This commit is contained in:
Cheng Zhao 2013-04-17 20:05:43 +08:00
parent b313d94a2f
commit 60528e53ee
11 changed files with 479 additions and 25 deletions

View file

@ -4,6 +4,7 @@
#include "browser/api/atom_bindings.h"
#include "base/logging.h"
#include "vendor/node/src/node.h"
#include "vendor/node/src/node_internals.h"
@ -31,6 +32,21 @@ void AtomBindings::BindTo(v8::Handle<v8::Object> process) {
node::SetMethod(process, "atom_binding", Binding);
}
void AtomBindings::AfterLoad() {
v8::HandleScope scope;
v8::Context::Scope context_scope(node::g_context);
v8::Handle<v8::Object> global = node::g_context->Global();
v8::Handle<v8::Object> atom =
global->Get(v8::String::New("__atom"))->ToObject();
DCHECK(!atom.IsEmpty());
browser_main_parts_ = v8::Persistent<v8::Object>::New(
node_isolate,
atom->Get(v8::String::New("browserMainParts"))->ToObject());
DCHECK(!browser_main_parts_.IsEmpty());
}
// static
v8::Handle<v8::Value> AtomBindings::Binding(const v8::Arguments& args) {
v8::HandleScope scope;