Chromium Code Reviews| Index: views/widget/native_widget_win.cc |
| diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc |
| index 8c20b03447cc2f7ba6c215f3332846583e3806ec..4e6fc15a6d6914262874c8241083610b8aa8781c 100644 |
| --- a/views/widget/native_widget_win.cc |
| +++ b/views/widget/native_widget_win.cc |
| @@ -637,8 +637,9 @@ void NativeWidgetWin::CenterWindow(const gfx::Size& size) { |
| ui::CenterAndSizeWindow(parent, GetNativeView(), size, false); |
| } |
| -void NativeWidgetWin::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
| - bool* maximized) const { |
| +void NativeWidgetWin::GetWindowBoundsAndShowState( |
| + gfx::Rect* bounds, |
| + ui::WindowShowState* show_state) const { |
| WINDOWPLACEMENT wp; |
| wp.length = sizeof(wp); |
| const bool succeeded = !!GetWindowPlacement(GetNativeView(), &wp); |
| @@ -656,8 +657,13 @@ void NativeWidgetWin::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
| mi.rcWork.top - mi.rcMonitor.top); |
| } |
| - if (maximized != NULL) |
| - *maximized = (wp.showCmd == SW_SHOWMAXIMIZED); |
| + if (show_state != NULL) { |
| + *show_state = ui::SHOW_STATE_NORMAL; |
|
sky
2011/08/26 16:26:20
nit: put this as the last 'else' branch of the if.
dhollowa
2011/08/26 22:13:50
Done.
|
| + if (wp.showCmd == SW_SHOWMAXIMIZED) |
| + *show_state = ui::SHOW_STATE_MAXIMIZED; |
| + else if (wp.showCmd == SW_SHOWMINIMIZED) |
| + *show_state = ui::SHOW_STATE_MINIMIZED; |
| + } |
| } |
| void NativeWidgetWin::SetWindowTitle(const std::wstring& title) { |
| @@ -761,7 +767,7 @@ gfx::Rect NativeWidgetWin::GetRestoredBounds() const { |
| return gfx::Rect(saved_window_info_.window_rect); |
| gfx::Rect bounds; |
| - GetWindowBoundsAndMaximizedState(&bounds, NULL); |
| + GetWindowBoundsAndShowState(&bounds, NULL); |
| return bounds; |
| } |
| @@ -877,15 +883,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; |
| @@ -2173,8 +2182,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) |