| Index: chrome/browser/ui/views/frame/browser_frame_win.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/frame/browser_frame_win.cc (revision 153679)
|
| +++ chrome/browser/ui/views/frame/browser_frame_win.cc (working copy)
|
| @@ -195,33 +195,49 @@
|
| NativeWidgetWin::UpdateFrameAfterFrameChange();
|
| }
|
|
|
| -void BrowserFrameWin::OnEndSession(BOOL ending, UINT logoff) {
|
| - browser::SessionEnding();
|
| +bool BrowserFrameWin::PreHandleMSG(UINT message,
|
| + WPARAM w_param,
|
| + LPARAM l_param,
|
| + LRESULT* result) {
|
| + switch (message) {
|
| + case WM_ENDSESSION:
|
| + browser::SessionEnding();
|
| + return true;
|
| + case WM_INITMENUPOPUP:
|
| + system_menu_->UpdateStates();
|
| + return true;
|
| + case WM_ACTIVATE:
|
| + if (LOWORD(w_param) != WA_INACTIVE)
|
| + CacheMinimizeButtonDelta();
|
| + return false;
|
| + }
|
| + return false;
|
| }
|
|
|
| -void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position,
|
| - BOOL is_system_menu) {
|
| - system_menu_->UpdateStates();
|
| -}
|
| +void BrowserFrameWin::PostHandleMSG(UINT message,
|
| + WPARAM w_param,
|
| + LPARAM l_param) {
|
| + switch (message) {
|
| + case WM_WINDOWPOSCHANGED:
|
| + UpdateDWMFrame();
|
|
|
| -void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) {
|
| - NativeWidgetWin::OnWindowPosChanged(window_pos);
|
| - UpdateDWMFrame();
|
| -
|
| - // Windows lies to us about the position of the minimize button before a
|
| - // window is visible. We use this position to place the OTR avatar in RTL
|
| - // mode, so when the window is shown, we need to re-layout and schedule a
|
| - // paint for the non-client frame view so that the icon top has the correct
|
| - // position when the window becomes visible. This fixes bugs where the icon
|
| - // appears to overlay the minimize button.
|
| - // Note that we will call Layout every time SetWindowPos is called with
|
| - // SWP_SHOWWINDOW, however callers typically are careful about not specifying
|
| - // this flag unless necessary to avoid flicker.
|
| - // This may be invoked during creation on XP and before the non_client_view
|
| - // has been created.
|
| - if (window_pos->flags & SWP_SHOWWINDOW && GetWidget()->non_client_view()) {
|
| - GetWidget()->non_client_view()->Layout();
|
| - GetWidget()->non_client_view()->SchedulePaint();
|
| + // Windows lies to us about the position of the minimize button before a
|
| + // window is visible. We use this position to place the OTR avatar in RTL
|
| + // mode, so when the window is shown, we need to re-layout and schedule a
|
| + // paint for the non-client frame view so that the icon top has the correct
|
| + // position when the window becomes visible. This fixes bugs where the icon
|
| + // appears to overlay the minimize button.
|
| + // Note that we will call Layout every time SetWindowPos is called with
|
| + // SWP_SHOWWINDOW, however callers typically are careful about not
|
| + // specifying this flag unless necessary to avoid flicker.
|
| + // This may be invoked during creation on XP and before the non_client_view
|
| + // has been created.
|
| + WINDOWPOS* window_pos = reinterpret_cast<WINDOWPOS*>(l_param);
|
| + if (window_pos->flags & SWP_SHOWWINDOW && GetWidget()->non_client_view()) {
|
| + GetWidget()->non_client_view()->Layout();
|
| + GetWidget()->non_client_view()->SchedulePaint();
|
| + }
|
| + break;
|
| }
|
| }
|
|
|
| @@ -269,12 +285,6 @@
|
| views::NativeWidgetWin::Close();
|
| }
|
|
|
| -void BrowserFrameWin::OnActivate(UINT action, BOOL minimized, HWND window) {
|
| - if (action != WA_INACTIVE)
|
| - CacheMinimizeButtonDelta();
|
| - views::NativeWidgetWin::OnActivate(action, minimized, window);
|
| -}
|
| -
|
| void BrowserFrameWin::FrameTypeChanged() {
|
| // In Windows 8 metro mode the frame type is set to FRAME_TYPE_FORCE_CUSTOM
|
| // by default. We reset it back to FRAME_TYPE_DEFAULT to ensure that we
|
| @@ -346,7 +356,7 @@
|
| DCHECK(cached_minimize_button_x_delta_);
|
|
|
| RECT client_rect = {0};
|
| - GetClientRect(&client_rect);
|
| + GetClientRect(GetNativeView(), &client_rect);
|
|
|
| if (base::i18n::IsRTL())
|
| return cached_minimize_button_x_delta_;
|
| @@ -579,7 +589,7 @@
|
| return;
|
|
|
| RECT rect = {0};
|
| - GetClientRect(&rect);
|
| + GetClientRect(GetNativeView(), &rect);
|
| // Calculate and cache the value of the minimize button delta, i.e. the
|
| // offset to be applied to the left or right edge of the client rect
|
| // depending on whether the language is RTL or not.
|
|
|