Merge pull request #1304 from atom/restore-window-state

Restore window state when showing window
This commit is contained in:
Cheng Zhao 2015-03-26 17:05:40 +08:00
commit 2cdfef286a
2 changed files with 13 additions and 1 deletions

View file

@ -307,7 +307,7 @@ bool NativeWindowViews::IsFocused() {
} }
void NativeWindowViews::Show() { void NativeWindowViews::Show() {
window_->Show(); window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
} }
void NativeWindowViews::ShowInactive() { void NativeWindowViews::ShowInactive() {
@ -927,6 +927,15 @@ gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds(
return window_bounds; return window_bounds;
} }
ui::WindowShowState NativeWindowViews::GetRestoredState() {
if (IsMaximized())
return ui::SHOW_STATE_MAXIMIZED;
if (IsFullscreen())
return ui::SHOW_STATE_FULLSCREEN;
return ui::SHOW_STATE_NORMAL;
}
// static // static
NativeWindow* NativeWindow::Create(content::WebContents* web_contents, NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
const mate::Dictionary& options) { const mate::Dictionary& options) {

View file

@ -141,6 +141,9 @@ class NativeWindowViews : public NativeWindow,
// in client area we need to substract/add menu bar's height in convertions. // in client area we need to substract/add menu bar's height in convertions.
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& content_bounds); gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& content_bounds);
// Returns the restore state for the window.
ui::WindowShowState GetRestoredState();
scoped_ptr<views::Widget> window_; scoped_ptr<views::Widget> window_;
views::View* web_view_; // Managed by inspectable_web_contents_. views::View* web_view_; // Managed by inspectable_web_contents_.