OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "views/widget/native_widget_win.h" | 5 #include "views/widget/native_widget_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 return 0; | 1263 return 0; |
1264 } | 1264 } |
1265 | 1265 |
1266 void NativeWidgetWin::OnDestroy() { | 1266 void NativeWidgetWin::OnDestroy() { |
1267 RestoreEnabledIfNecessary(); | 1267 RestoreEnabledIfNecessary(); |
1268 delegate_->OnNativeWidgetDestroying(); | 1268 delegate_->OnNativeWidgetDestroying(); |
1269 if (drop_target_.get()) { | 1269 if (drop_target_.get()) { |
1270 RevokeDragDrop(hwnd()); | 1270 RevokeDragDrop(hwnd()); |
1271 drop_target_ = NULL; | 1271 drop_target_ = NULL; |
1272 } | 1272 } |
1273 | |
1274 props_.reset(); | |
1275 } | 1273 } |
1276 | 1274 |
1277 void NativeWidgetWin::OnDisplayChange(UINT bits_per_pixel, CSize screen_size) { | 1275 void NativeWidgetWin::OnDisplayChange(UINT bits_per_pixel, CSize screen_size) { |
1278 GetWidget()->widget_delegate()->OnDisplayChanged(); | 1276 GetWidget()->widget_delegate()->OnDisplayChanged(); |
1279 } | 1277 } |
1280 | 1278 |
1281 LRESULT NativeWidgetWin::OnDwmCompositionChanged(UINT msg, | 1279 LRESULT NativeWidgetWin::OnDwmCompositionChanged(UINT msg, |
1282 WPARAM w_param, | 1280 WPARAM w_param, |
1283 LPARAM l_param) { | 1281 LPARAM l_param) { |
1284 if (!GetWidget()->non_client_view()) { | 1282 if (!GetWidget()->non_client_view()) { |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 if (DidClientAreaSizeChange(window_pos)) | 2041 if (DidClientAreaSizeChange(window_pos)) |
2044 ClientAreaSizeChanged(); | 2042 ClientAreaSizeChanged(); |
2045 if (window_pos->flags & SWP_SHOWWINDOW) | 2043 if (window_pos->flags & SWP_SHOWWINDOW) |
2046 delegate_->OnNativeWidgetVisibilityChanged(true); | 2044 delegate_->OnNativeWidgetVisibilityChanged(true); |
2047 else if (window_pos->flags & SWP_HIDEWINDOW) | 2045 else if (window_pos->flags & SWP_HIDEWINDOW) |
2048 delegate_->OnNativeWidgetVisibilityChanged(false); | 2046 delegate_->OnNativeWidgetVisibilityChanged(false); |
2049 SetMsgHandled(FALSE); | 2047 SetMsgHandled(FALSE); |
2050 } | 2048 } |
2051 | 2049 |
2052 void NativeWidgetWin::OnFinalMessage(HWND window) { | 2050 void NativeWidgetWin::OnFinalMessage(HWND window) { |
| 2051 // We don't destroy props in WM_DESTROY as we may still get messages after |
| 2052 // WM_DESTROY that assume the properties are still valid (such as WM_CLOSE). |
| 2053 props_.reset(); |
2053 delegate_->OnNativeWidgetDestroyed(); | 2054 delegate_->OnNativeWidgetDestroyed(); |
2054 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 2055 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
2055 delete this; | 2056 delete this; |
2056 } | 2057 } |
2057 | 2058 |
2058 //////////////////////////////////////////////////////////////////////////////// | 2059 //////////////////////////////////////////////////////////////////////////////// |
2059 // NativeWidgetWin, protected: | 2060 // NativeWidgetWin, protected: |
2060 | 2061 |
2061 int NativeWidgetWin::GetShowState() const { | 2062 int NativeWidgetWin::GetShowState() const { |
2062 return SW_SHOWNORMAL; | 2063 return SW_SHOWNORMAL; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2530 return (GetKeyState(VK_LBUTTON) & 0x80) || | 2531 return (GetKeyState(VK_LBUTTON) & 0x80) || |
2531 (GetKeyState(VK_RBUTTON) & 0x80) || | 2532 (GetKeyState(VK_RBUTTON) & 0x80) || |
2532 (GetKeyState(VK_MBUTTON) & 0x80) || | 2533 (GetKeyState(VK_MBUTTON) & 0x80) || |
2533 (GetKeyState(VK_XBUTTON1) & 0x80) || | 2534 (GetKeyState(VK_XBUTTON1) & 0x80) || |
2534 (GetKeyState(VK_XBUTTON2) & 0x80); | 2535 (GetKeyState(VK_XBUTTON2) & 0x80); |
2535 } | 2536 } |
2536 | 2537 |
2537 } // namespace internal | 2538 } // namespace internal |
2538 | 2539 |
2539 } // namespace views | 2540 } // namespace views |
OLD | NEW |