Add isDestroyed method for classes with destroy method
This commit is contained in:
parent
ed1f9989b0
commit
9a20b33d97
5 changed files with 4 additions and 13 deletions
|
@ -161,6 +161,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
|
||||||
v8::Local<v8::ObjectTemplate> prototype) {
|
v8::Local<v8::ObjectTemplate> prototype) {
|
||||||
mate::ObjectTemplateBuilder(isolate, prototype)
|
mate::ObjectTemplateBuilder(isolate, prototype)
|
||||||
.SetMethod("destroy", &Tray::Destroy, true)
|
.SetMethod("destroy", &Tray::Destroy, true)
|
||||||
|
.SetMethod("isDestroyed", &Tray::IsDestroyed, true)
|
||||||
.SetMethod("setImage", &Tray::SetImage)
|
.SetMethod("setImage", &Tray::SetImage)
|
||||||
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
||||||
.SetMethod("setToolTip", &Tray::SetToolTip)
|
.SetMethod("setToolTip", &Tray::SetToolTip)
|
||||||
|
|
|
@ -604,10 +604,6 @@ void WebContents::Destroy() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsAlive() const {
|
|
||||||
return web_contents() != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int WebContents::GetID() const {
|
int WebContents::GetID() const {
|
||||||
return web_contents()->GetRenderProcessHost()->GetID();
|
return web_contents()->GetRenderProcessHost()->GetID();
|
||||||
}
|
}
|
||||||
|
@ -996,7 +992,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||||
if (template_.IsEmpty())
|
if (template_.IsEmpty())
|
||||||
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
|
template_.Reset(isolate, mate::ObjectTemplateBuilder(isolate)
|
||||||
.SetMethod("destroy", &WebContents::Destroy, true)
|
.SetMethod("destroy", &WebContents::Destroy, true)
|
||||||
.SetMethod("isAlive", &WebContents::IsAlive, true)
|
.SetMethod("isDestroyed", &WebContents::IsDestroyed, true)
|
||||||
.SetMethod("getId", &WebContents::GetID)
|
.SetMethod("getId", &WebContents::GetID)
|
||||||
.SetMethod("equal", &WebContents::Equal)
|
.SetMethod("equal", &WebContents::Equal)
|
||||||
.SetMethod("_loadURL", &WebContents::LoadURL)
|
.SetMethod("_loadURL", &WebContents::LoadURL)
|
||||||
|
@ -1066,7 +1062,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsDestroyed() const {
|
bool WebContents::IsDestroyed() const {
|
||||||
return !IsAlive();
|
return !web_contents();
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomBrowserContext* WebContents::GetBrowserContext() const {
|
AtomBrowserContext* WebContents::GetBrowserContext() const {
|
||||||
|
|
|
@ -57,7 +57,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
// mate::TrackableObject:
|
// mate::TrackableObject:
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
|
|
||||||
bool IsAlive() const;
|
|
||||||
int GetID() const;
|
int GetID() const;
|
||||||
bool Equal(const WebContents* web_contents) const;
|
bool Equal(const WebContents* web_contents) const;
|
||||||
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
void LoadURL(const GURL& url, const mate::Dictionary& options);
|
||||||
|
|
|
@ -284,10 +284,6 @@ void Window::Close() {
|
||||||
window_->Close();
|
window_->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::IsClosed() {
|
|
||||||
return window_->IsClosed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::Focus() {
|
void Window::Focus() {
|
||||||
window_->Focus(true);
|
window_->Focus(true);
|
||||||
}
|
}
|
||||||
|
@ -622,8 +618,8 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||||
v8::Local<v8::ObjectTemplate> prototype) {
|
v8::Local<v8::ObjectTemplate> prototype) {
|
||||||
mate::ObjectTemplateBuilder(isolate, prototype)
|
mate::ObjectTemplateBuilder(isolate, prototype)
|
||||||
.SetMethod("destroy", &Window::Destroy, true)
|
.SetMethod("destroy", &Window::Destroy, true)
|
||||||
|
.SetMethod("isDestroyed", &Window::IsDestroyed, true)
|
||||||
.SetMethod("close", &Window::Close)
|
.SetMethod("close", &Window::Close)
|
||||||
.SetMethod("isClosed", &Window::IsClosed)
|
|
||||||
.SetMethod("focus", &Window::Focus)
|
.SetMethod("focus", &Window::Focus)
|
||||||
.SetMethod("isFocused", &Window::IsFocused)
|
.SetMethod("isFocused", &Window::IsFocused)
|
||||||
.SetMethod("show", &Window::Show)
|
.SetMethod("show", &Window::Show)
|
||||||
|
|
|
@ -89,7 +89,6 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
|
|
||||||
// APIs for NativeWindow.
|
// APIs for NativeWindow.
|
||||||
void Close();
|
void Close();
|
||||||
bool IsClosed();
|
|
||||||
void Focus();
|
void Focus();
|
||||||
bool IsFocused();
|
bool IsFocused();
|
||||||
void Show();
|
void Show();
|
||||||
|
|
Loading…
Reference in a new issue