Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: views/widget/native_widget_win.cc

Issue 7748036: Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/native_widget_win.cc
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 0e459c76f9fe7c6f9fb188d2b6f918bf9527de7a..173ad252199f051463eb96dec3cc0d2a7fcfccd4 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -627,11 +627,12 @@ void NativeWidgetWin::CenterWindow(const gfx::Size& size) {
ui::CenterAndSizeWindow(parent, GetNativeView(), size, false);
}
-void NativeWidgetWin::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds,
- bool* maximized) const {
+void NativeWidgetWin::GetWindowPlacement(
+ gfx::Rect* bounds,
+ ui::WindowShowState* show_state) const {
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
- const bool succeeded = !!GetWindowPlacement(GetNativeView(), &wp);
+ const bool succeeded = !!::GetWindowPlacement(GetNativeView(), &wp);
DCHECK(succeeded);
if (bounds != NULL) {
@@ -646,8 +647,14 @@ void NativeWidgetWin::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds,
mi.rcWork.top - mi.rcMonitor.top);
}
- if (maximized != NULL)
- *maximized = (wp.showCmd == SW_SHOWMAXIMIZED);
+ if (show_state != NULL) {
+ if (wp.showCmd == SW_SHOWMAXIMIZED)
+ *show_state = ui::SHOW_STATE_MAXIMIZED;
+ else if (wp.showCmd == SW_SHOWMINIMIZED)
+ *show_state = ui::SHOW_STATE_MINIMIZED;
+ else
+ *show_state = ui::SHOW_STATE_NORMAL;
+ }
}
void NativeWidgetWin::SetWindowTitle(const std::wstring& title) {
@@ -749,7 +756,7 @@ gfx::Rect NativeWidgetWin::GetRestoredBounds() const {
return gfx::Rect(saved_window_info_.window_rect);
gfx::Rect bounds;
- GetWindowBoundsAndMaximizedState(&bounds, NULL);
+ GetWindowPlacement(&bounds, NULL);
return bounds;
}
@@ -865,15 +872,18 @@ void NativeWidgetWin::ShowMaximizedWithBounds(
SetWindowPlacement(hwnd(), &placement);
}
-void NativeWidgetWin::ShowWithState(ShowState state) {
+void NativeWidgetWin::ShowWithWindowState(ui::WindowShowState show_state) {
DWORD native_show_state;
- switch (state) {
- case SHOW_INACTIVE:
+ switch (show_state) {
+ case ui::SHOW_STATE_INACTIVE:
native_show_state = SW_SHOWNOACTIVATE;
break;
- case SHOW_MAXIMIZED:
+ case ui::SHOW_STATE_MAXIMIZED:
native_show_state = SW_SHOWMAXIMIZED;
break;
+ case ui::SHOW_STATE_MINIMIZED:
+ native_show_state = SW_SHOWMINIMIZED;
+ break;
default:
native_show_state = GetShowState();
break;
@@ -2164,8 +2174,10 @@ void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) {
// Set type-independent style attributes.
if (params.child)
style |= WS_CHILD | WS_VISIBLE;
- if (params.maximize)
+ if (params.show_state == ui::SHOW_STATE_MAXIMIZED)
style |= WS_MAXIMIZE;
+ if (params.show_state == ui::SHOW_STATE_MINIMIZED)
+ style |= WS_MINIMIZE;
if (!params.accept_events)
ex_style |= WS_EX_TRANSPARENT;
if (!params.can_activate)
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698