2013-04-14 07:36:48 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2013-04-15 15:01:12 +00:00
|
|
|
#include "browser/api/atom_api_window.h"
|
2013-04-14 07:36:48 +00:00
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
#include "base/values.h"
|
|
|
|
#include "browser/native_window.h"
|
2013-09-24 01:41:54 +00:00
|
|
|
#include "common/v8_conversions.h"
|
2013-04-17 12:05:43 +00:00
|
|
|
#include "common/v8_value_converter_impl.h"
|
2013-04-18 16:06:10 +00:00
|
|
|
#include "content/public/browser/navigation_entry.h"
|
2013-04-17 12:05:43 +00:00
|
|
|
#include "content/public/browser/web_contents.h"
|
2013-04-23 09:21:34 +00:00
|
|
|
#include "content/public/browser/render_process_host.h"
|
2013-04-17 14:49:49 +00:00
|
|
|
#include "ui/gfx/point.h"
|
|
|
|
#include "ui/gfx/rect.h"
|
|
|
|
#include "ui/gfx/size.h"
|
2013-04-15 16:25:08 +00:00
|
|
|
|
|
|
|
using content::V8ValueConverter;
|
2013-04-18 07:09:53 +00:00
|
|
|
using content::NavigationController;
|
2013-04-17 14:49:49 +00:00
|
|
|
using node::ObjectWrap;
|
2013-04-15 16:25:08 +00:00
|
|
|
|
2013-04-29 11:38:18 +00:00
|
|
|
#define UNWRAP_WINDOW_AND_CHECK \
|
2013-06-18 13:40:03 +00:00
|
|
|
Window* self = ObjectWrap::Unwrap<Window>(args.This()); \
|
|
|
|
if (self == NULL) \
|
|
|
|
return node::ThrowError("Window is already destroyed")
|
2013-04-29 11:38:18 +00:00
|
|
|
|
2013-04-14 07:36:48 +00:00
|
|
|
namespace atom {
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
namespace api {
|
|
|
|
|
|
|
|
Window::Window(v8::Handle<v8::Object> wrapper, base::DictionaryValue* options)
|
|
|
|
: EventEmitter(wrapper),
|
2013-04-20 05:42:39 +00:00
|
|
|
window_(NativeWindow::Create(options)) {
|
2013-04-17 12:05:43 +00:00
|
|
|
window_->InitFromOptions(options);
|
2013-04-18 15:50:47 +00:00
|
|
|
window_->AddObserver(this);
|
2013-04-15 16:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Window::~Window() {
|
2013-05-02 10:19:07 +00:00
|
|
|
Emit("destroyed");
|
|
|
|
|
2013-05-01 15:28:01 +00:00
|
|
|
window_->RemoveObserver(this);
|
2013-04-15 16:25:08 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 15:50:47 +00:00
|
|
|
void Window::OnPageTitleUpdated(bool* prevent_default,
|
|
|
|
const std::string& title) {
|
2013-05-01 15:28:01 +00:00
|
|
|
base::ListValue args;
|
|
|
|
args.AppendString(title);
|
|
|
|
*prevent_default = Emit("page-title-updated", &args);
|
|
|
|
}
|
|
|
|
|
2013-08-29 03:47:07 +00:00
|
|
|
void Window::OnLoadingStateChanged(bool is_loading) {
|
|
|
|
base::ListValue args;
|
|
|
|
args.AppendBoolean(is_loading);
|
|
|
|
Emit("loading-state-changed", &args);
|
|
|
|
}
|
|
|
|
|
2013-05-01 15:28:01 +00:00
|
|
|
void Window::WillCloseWindow(bool* prevent_default) {
|
2013-05-02 10:19:07 +00:00
|
|
|
*prevent_default = Emit("close");
|
2013-05-01 15:28:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window::OnWindowClosed() {
|
2013-05-02 10:19:07 +00:00
|
|
|
Emit("closed");
|
|
|
|
|
2013-09-27 07:20:55 +00:00
|
|
|
// Free memory when native window is closed, the delete is delayed so other
|
|
|
|
// observers would not get a invalid pointer of NativeWindow.
|
|
|
|
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
|
2013-04-18 15:50:47 +00:00
|
|
|
}
|
|
|
|
|
2013-05-24 09:58:39 +00:00
|
|
|
void Window::OnWindowBlur() {
|
|
|
|
Emit("blur");
|
|
|
|
}
|
|
|
|
|
2013-06-06 11:45:48 +00:00
|
|
|
void Window::OnRendererUnresponsive() {
|
|
|
|
Emit("unresponsive");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::OnRendererResponsive() {
|
|
|
|
Emit("responsive");
|
|
|
|
}
|
|
|
|
|
2013-06-10 12:50:25 +00:00
|
|
|
void Window::OnRendererCrashed() {
|
|
|
|
Emit("crashed");
|
|
|
|
}
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::New(const v8::Arguments &args) {
|
2013-06-18 10:35:08 +00:00
|
|
|
v8::HandleScope scope;
|
2013-04-29 11:38:18 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
if (!args.IsConstructCall())
|
|
|
|
return node::ThrowError("Require constructor call");
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
if (!args[0]->IsObject())
|
2013-04-29 11:38:18 +00:00
|
|
|
return node::ThrowTypeError("Need options creating Window");
|
2013-04-15 16:25:08 +00:00
|
|
|
|
2013-04-17 12:05:43 +00:00
|
|
|
scoped_ptr<V8ValueConverter> converter(new V8ValueConverterImpl());
|
2013-04-15 16:25:08 +00:00
|
|
|
scoped_ptr<base::Value> options(
|
|
|
|
converter->FromV8Value(args[0], v8::Context::GetCurrent()));
|
|
|
|
|
|
|
|
if (!options || !options->IsType(base::Value::TYPE_DICTIONARY))
|
2013-04-29 11:38:18 +00:00
|
|
|
return node::ThrowTypeError("Invalid options");
|
2013-04-15 16:25:08 +00:00
|
|
|
|
|
|
|
new Window(args.This(), static_cast<base::DictionaryValue*>(options.get()));
|
|
|
|
|
2013-10-05 13:05:59 +00:00
|
|
|
// Give js code a chance to do initialization.
|
|
|
|
node::MakeCallback(args.This(), "_init", 0, NULL);
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
return args.This();
|
2013-04-14 07:36:48 +00:00
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Destroy(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
delete self;
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Close(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Close();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Focus(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Focus(args[0]->IsBoolean() ? args[0]->BooleanValue(): true);
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-05-16 14:56:52 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsFocused(const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsFocused());
|
2013-05-16 14:56:52 +00:00
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Show(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Show();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Hide(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Hide();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Maximize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Maximize();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Unmaximize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Unmaximize();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Minimize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Minimize();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Restore(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->Restore();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetFullscreen(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
bool fs;
|
|
|
|
if (!FromV8Arguments(args, &fs))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetFullscreen(fs);
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsFullscreen(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsFullscreen());
|
2013-04-17 14:49:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int width, height;
|
|
|
|
if (!FromV8Arguments(args, &width, &height))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetSize(gfx::Size(width, height));
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
gfx::Size size = self->window_->GetSize();
|
|
|
|
v8::Handle<v8::Array> ret = v8::Array::New(2);
|
2013-09-24 01:41:54 +00:00
|
|
|
ret->Set(0, ToV8Value(size.width()));
|
|
|
|
ret->Set(1, ToV8Value(size.height()));
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetMinimumSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int width, height;
|
|
|
|
if (!FromV8Arguments(args, &width, &height))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetMinimumSize(gfx::Size(width, height));
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 07:38:04 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetMinimumSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:38:04 +00:00
|
|
|
|
|
|
|
gfx::Size size = self->window_->GetMinimumSize();
|
|
|
|
v8::Handle<v8::Array> ret = v8::Array::New(2);
|
2013-09-24 01:41:54 +00:00
|
|
|
ret->Set(0, ToV8Value(size.width()));
|
|
|
|
ret->Set(1, ToV8Value(size.height()));
|
2013-04-18 07:38:04 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetMaximumSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
|
|
|
|
int width, height;
|
|
|
|
if (!FromV8Arguments(args, &width, &height))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetMaximumSize(gfx::Size(width, height));
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 07:38:04 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetMaximumSize(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:38:04 +00:00
|
|
|
|
|
|
|
gfx::Size size = self->window_->GetMaximumSize();
|
|
|
|
v8::Handle<v8::Array> ret = v8::Array::New(2);
|
2013-09-24 01:41:54 +00:00
|
|
|
ret->Set(0, ToV8Value(size.width()));
|
|
|
|
ret->Set(1, ToV8Value(size.height()));
|
2013-04-18 07:38:04 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetResizable(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
bool resizable;
|
|
|
|
if (!FromV8Arguments(args, &resizable))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetResizable(resizable);
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 07:38:04 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsResizable(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:38:04 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsResizable());
|
2013-04-18 07:38:04 +00:00
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetAlwaysOnTop(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
bool top;
|
|
|
|
if (!FromV8Arguments(args, &top))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetAlwaysOnTop(top);
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 07:38:04 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsAlwaysOnTop(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:38:04 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsAlwaysOnTop());
|
2013-04-18 07:38:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-10 12:34:05 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Center(const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
|
|
|
self->window_->Center();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetPosition(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int x, y;
|
|
|
|
if (!FromV8Arguments(args, &x, &y))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetPosition(gfx::Point(x, y));
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetPosition(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
gfx::Point pos = self->window_->GetPosition();
|
|
|
|
v8::Handle<v8::Array> ret = v8::Array::New(2);
|
2013-09-24 01:41:54 +00:00
|
|
|
ret->Set(0, ToV8Value(pos.x()));
|
|
|
|
ret->Set(1, ToV8Value(pos.y()));
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetTitle(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
std::string title;
|
|
|
|
if (!FromV8Arguments(args, &title))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetTitle(title);
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 06:30:05 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetTitle(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetTitle());
|
2013-04-18 06:30:05 +00:00
|
|
|
}
|
|
|
|
|
2013-04-17 14:49:49 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::FlashFrame(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->FlashFrame(
|
|
|
|
args[0]->IsBoolean() ? args[0]->BooleanValue(): true);
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::SetKiosk(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
bool kiosk;
|
|
|
|
if (!FromV8Arguments(args, &kiosk))
|
2013-04-17 14:49:49 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->SetKiosk(kiosk);
|
2013-04-17 14:49:49 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsKiosk(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsKiosk());
|
2013-04-17 14:49:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
2013-05-10 12:34:05 +00:00
|
|
|
v8::Handle<v8::Value> Window::OpenDevTools(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-05-10 12:34:05 +00:00
|
|
|
self->window_->OpenDevTools();
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::CloseDevTools(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-17 14:49:49 +00:00
|
|
|
|
|
|
|
self->window_->CloseDevTools();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-07-18 11:21:25 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::InspectElement(const v8::Arguments& args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int x, y;
|
|
|
|
if (!FromV8Arguments(args, &x, &y))
|
|
|
|
return node::ThrowTypeError("Bad argument");
|
2013-07-18 11:21:25 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
self->window_->InspectElement(x, y);
|
2013-07-18 11:21:25 +00:00
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-05-24 09:51:15 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::FocusOnWebView(const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
|
|
|
self->window_->FocusOnWebView();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::BlurWebView(const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
|
|
|
self->window_->BlurWebView();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-08-16 04:56:25 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsWebViewFocused(const v8::Arguments& args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->IsWebViewFocused());
|
2013-08-16 04:56:25 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 10:42:57 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::RestartHangMonitorTimeout(
|
|
|
|
const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
|
|
|
self->window_->RestartHangMonitorTimeout();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 07:09:53 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetPageTitle(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetWebContents()->GetTitle());
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsLoading(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetWebContents()->IsLoading());
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsWaitingForResponse(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetWebContents()->IsWaitingForResponse());
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Stop(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
self->window_->GetWebContents()->Stop();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-23 09:21:34 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetRoutingID(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-23 09:21:34 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetWebContents()->GetRoutingID());
|
2013-04-23 09:21:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetProcessID(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-23 09:21:34 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(
|
2013-04-23 09:21:34 +00:00
|
|
|
self->window_->GetWebContents()->GetRenderProcessHost()->GetID());
|
|
|
|
}
|
|
|
|
|
2013-06-10 12:50:25 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::IsCrashed(const v8::Arguments &args) {
|
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(self->window_->GetWebContents()->IsCrashed());
|
2013-06-10 12:50:25 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 07:09:53 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::LoadURL(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
std::string url;
|
|
|
|
if (!FromV8Arguments(args, &url))
|
2013-04-18 07:09:53 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
2013-09-24 01:41:54 +00:00
|
|
|
controller.LoadURL(GURL(url),
|
2013-04-18 07:09:53 +00:00
|
|
|
content::Referrer(),
|
|
|
|
content::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
|
|
|
std::string());
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-18 16:06:10 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GetURL(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 16:06:10 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
std::string url;
|
|
|
|
if (controller.GetActiveEntry())
|
|
|
|
url = controller.GetActiveEntry()->GetVirtualURL().spec();
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(url);
|
2013-04-18 16:06:10 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 07:09:53 +00:00
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::CanGoBack(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(controller.CanGoBack());
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::CanGoForward(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(controller.CanGoForward());
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::CanGoToOffset(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int offset;
|
|
|
|
if (!FromV8Arguments(args, &offset))
|
2013-04-18 07:09:53 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
return ToV8Value(controller.CanGoToOffset(offset));
|
2013-04-18 07:09:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GoBack(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
controller.GoBack();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GoForward(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
controller.GoForward();
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GoToIndex(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int index;
|
|
|
|
if (!FromV8Arguments(args, &index))
|
2013-04-18 07:09:53 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
2013-09-24 01:41:54 +00:00
|
|
|
controller.GoToIndex(index);
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::GoToOffset(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-09-24 01:41:54 +00:00
|
|
|
int offset;
|
|
|
|
if (!FromV8Arguments(args, &offset))
|
2013-04-18 07:09:53 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
2013-09-24 01:41:54 +00:00
|
|
|
controller.GoToOffset(offset);
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::Reload(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
controller.Reload(args[0]->IsBoolean() ? args[0]->BooleanValue(): false);
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
v8::Handle<v8::Value> Window::ReloadIgnoringCache(const v8::Arguments &args) {
|
2013-04-29 11:38:18 +00:00
|
|
|
UNWRAP_WINDOW_AND_CHECK;
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NavigationController& controller =
|
|
|
|
self->window_->GetWebContents()->GetController();
|
|
|
|
controller.ReloadIgnoringCache(
|
|
|
|
args[0]->IsBoolean() ? args[0]->BooleanValue(): false);
|
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
2013-04-15 16:25:08 +00:00
|
|
|
// static
|
|
|
|
void Window::Initialize(v8::Handle<v8::Object> target) {
|
|
|
|
v8::HandleScope scope;
|
|
|
|
|
|
|
|
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(Window::New);
|
|
|
|
t->InstanceTemplate()->SetInternalFieldCount(1);
|
2013-06-18 13:40:03 +00:00
|
|
|
t->SetClassName(v8::String::NewSymbol("BrowserWindow"));
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus);
|
2013-05-16 14:56:52 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isFocused", IsFocused);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "show", Show);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "hide", Hide);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "maximize", Maximize);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "unmaximize", Unmaximize);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "minimize", Minimize);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "restore", Restore);
|
2013-06-07 06:05:56 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setFullScreen", SetFullscreen);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isFullScreen", IsFullscreen);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setSize", SetSize);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getSize", GetSize);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setMinimumSize", SetMinimumSize);
|
2013-04-18 07:38:04 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getMinimumSize", GetMinimumSize);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setMaximumSize", SetMaximumSize);
|
2013-04-18 07:38:04 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getMaximumSize", GetMaximumSize);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setResizable", SetResizable);
|
2013-04-18 07:38:04 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isResizable", IsResizable);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setAlwaysOnTop", SetAlwaysOnTop);
|
2013-04-18 07:38:04 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isAlwaysOnTop", IsAlwaysOnTop);
|
2013-05-10 12:34:05 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "center", Center);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setPosition", SetPosition);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getPosition", GetPosition);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setTitle", SetTitle);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getTitle", GetTitle);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "flashFrame", FlashFrame);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setKiosk", SetKiosk);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isKiosk", IsKiosk);
|
2013-05-10 12:34:05 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "openDevTools", OpenDevTools);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "closeDevTools", CloseDevTools);
|
2013-07-18 11:21:25 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "inspectElement", InspectElement);
|
2013-05-24 09:51:15 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "focusOnWebView", FocusOnWebView);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "blurWebView", BlurWebView);
|
2013-08-16 04:56:25 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isWebViewFocused", IsWebViewFocused);
|
2013-06-07 10:42:57 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t,
|
|
|
|
"restartHangMonitorTimeout",
|
|
|
|
RestartHangMonitorTimeout);
|
2013-04-18 07:09:53 +00:00
|
|
|
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getPageTitle", GetPageTitle);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isLoading", IsLoading);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isWaitingForResponse", IsWaitingForResponse);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "stop", Stop);
|
2013-05-03 07:21:41 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getRoutingId", GetRoutingID);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getProcessId", GetProcessID);
|
2013-06-10 12:50:25 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "isCrashed", IsCrashed);
|
2013-04-18 07:09:53 +00:00
|
|
|
|
2013-05-03 07:21:41 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "loadUrl", LoadURL);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "getUrl", GetURL);
|
2013-04-18 07:09:53 +00:00
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "canGoBack", CanGoBack);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "canGoForward", CanGoForward);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "canGoToOffset", CanGoToOffset);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "goBack", GoBack);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "goForward", GoForward);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "goToIndex", GoToIndex);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "goToOffset", GoToOffset);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "reload", Reload);
|
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "reloadIgnoringCache", ReloadIgnoringCache);
|
2013-04-17 14:49:49 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
target->Set(v8::String::NewSymbol("BrowserWindow"), t->GetFunction());
|
2013-04-15 16:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace api
|
|
|
|
|
2013-04-14 07:36:48 +00:00
|
|
|
} // namespace atom
|
|
|
|
|
2013-04-21 06:53:26 +00:00
|
|
|
NODE_MODULE(atom_browser_window, atom::api::Window::Initialize)
|