OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/native_control_win.h" | 5 #include "ui/views/controls/native_control_win.h" |
6 | 6 |
7 #include <windowsx.h> | 7 #include <windowsx.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/accessibility/accessibility_types.h" | 10 #include "ui/base/accessibility/accessibility_types.h" |
11 #include "ui/base/l10n/l10n_util_win.h" | 11 #include "ui/base/l10n/l10n_util_win.h" |
12 #include "ui/base/view_prop.h" | 12 #include "ui/base/view_prop.h" |
13 #include "ui/base/win/hwnd_util.h" | 13 #include "ui/base/win/hwnd_util.h" |
14 #include "ui/views/controls/combobox/combobox.h" | 14 #include "ui/views/controls/combobox/combobox.h" |
15 #include "ui/views/focus/focus_manager.h" | 15 #include "ui/views/focus/focus_manager.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 | 17 |
18 using ui::ViewProp; | 18 using ui::ViewProp; |
19 | 19 |
20 const char kNativeControlWinKey[] = "__NATIVE_CONTROL_WIN__"; | 20 const char kNativeControlWinKey[] = "__NATIVE_CONTROL_WIN__"; |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 | 23 |
24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
25 // NativeControlWin, public: | 25 // NativeControlWin, public: |
26 | 26 |
27 NativeControlWin::NativeControlWin() { | 27 NativeControlWin::NativeControlWin() : original_wndproc_(NULL) { |
28 } | 28 } |
29 | 29 |
30 NativeControlWin::~NativeControlWin() { | 30 NativeControlWin::~NativeControlWin() { |
31 HWND hwnd = native_view(); | 31 HWND hwnd = native_view(); |
32 if (hwnd) { | 32 if (hwnd) { |
33 // Destroy the hwnd if it still exists. Otherwise we won't have shut things | 33 // Destroy the hwnd if it still exists. Otherwise we won't have shut things |
34 // down correctly, leading to leaking and crashing if another message | 34 // down correctly, leading to leaking and crashing if another message |
35 // comes in for the hwnd. | 35 // comes in for the hwnd. |
36 Detach(); | 36 Detach(); |
37 DestroyWindow(hwnd); | 37 DestroyWindow(hwnd); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } else if (message == WM_DESTROY) { | 217 } else if (message == WM_DESTROY) { |
218 native_control->props_.clear(); | 218 native_control->props_.clear(); |
219 ui::SetWindowProc(window, native_control->original_wndproc_); | 219 ui::SetWindowProc(window, native_control->original_wndproc_); |
220 } | 220 } |
221 | 221 |
222 return CallWindowProc(native_control->original_wndproc_, window, message, | 222 return CallWindowProc(native_control->original_wndproc_, window, message, |
223 w_param, l_param); | 223 w_param, l_param); |
224 } | 224 } |
225 | 225 |
226 } // namespace views | 226 } // namespace views |
OLD | NEW |