Enable passing null to dialog API.

This commit is contained in:
Cheng Zhao 2014-04-24 13:10:04 +08:00
parent 83debe2e43
commit d3cda97d50
2 changed files with 35 additions and 22 deletions

View file

@ -134,4 +134,27 @@ class Window : public mate::EventEmitter,
} // namespace atom
namespace mate {
template<>
struct Converter<atom::NativeWindow*> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
atom::NativeWindow** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {
*out = NULL;
return true;
}
atom::api::Window* window;
if (!Converter<atom::api::Window*>::FromV8(isolate, val, &window))
return false;
*out = window->window();
return true;
}
};
} // namespace mate
#endif // ATOM_BROWSER_API_ATOM_API_WINDOW_H_