Move disable counter to NativeWindow from api::Window

This commit is contained in:
Cheng Zhao 2016-06-20 11:48:46 +09:00
parent 946d246aea
commit 1866dbe608
8 changed files with 36 additions and 40 deletions

View file

@ -56,6 +56,7 @@ NativeWindow::NativeWindow(
sheet_offset_x_(0.0),
sheet_offset_y_(0.0),
aspect_ratio_(0.0),
disable_count_(0),
inspectable_web_contents_(inspectable_web_contents),
weak_factory_(this) {
options.Get(options::kFrame, &has_frame_);
@ -178,6 +179,18 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
Show();
}
void NativeWindow::Disable() {
++disable_count_;
if (disable_count_ == 1)
SetEnabled(false);
}
void NativeWindow::Enable() {
--disable_count_;
if (disable_count_ == 0)
SetEnabled(true);
}
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
SetBounds(gfx::Rect(GetPosition(), size), animate);
}