| Index: views/controls/native_control_win.cc
|
| ===================================================================
|
| --- views/controls/native_control_win.cc (revision 27081)
|
| +++ views/controls/native_control_win.cc (working copy)
|
| @@ -24,10 +24,9 @@
|
| NativeControlWin::~NativeControlWin() {
|
| HWND hwnd = native_view();
|
| if (hwnd) {
|
| - // Destroy the hwnd if it still exists. Otherwise we won't have shut things
|
| - // down correctly, leading to leaking and crashing if another message
|
| - // comes in for the hwnd.
|
| - Detach();
|
| + // Destroy the hwnd if it still exists. Otherwise we won't shut things down
|
| + // correctly, leading to leaking and crashing if another message comes in
|
| + // for the hwnd.
|
| DestroyWindow(hwnd);
|
| }
|
| }
|
| @@ -74,9 +73,7 @@
|
| if (!is_visible) {
|
| // We destroy the child control HWND when we become invisible because of the
|
| // performance cost of maintaining many HWNDs.
|
| - HWND hwnd = native_view();
|
| - Detach();
|
| - DestroyWindow(hwnd);
|
| + DestroyWindow(native_view());
|
| } else if (!native_view()) {
|
| if (GetWidget())
|
| CreateNativeControl();
|
| @@ -117,14 +114,14 @@
|
| // Note that we never unset this property. We don't have to.
|
| SetProp(native_control, kNativeControlWinKey, this);
|
|
|
| - // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages.
|
| + Attach(native_control);
|
| + // native_view() is now valid.
|
| +
|
| + // Subclass so we get WM_KEYDOWN message.
|
| original_wndproc_ =
|
| win_util::SetWindowProc(native_control,
|
| &NativeControlWin::NativeControlWndProc);
|
|
|
| - Attach(native_control);
|
| - // native_view() is now valid.
|
| -
|
| // Update the newly created HWND with any resident enabled state.
|
| EnableWindow(native_view(), IsEnabled());
|
|
|
| @@ -186,16 +183,10 @@
|
| if (message == WM_KEYDOWN &&
|
| native_control->OnKeyDown(static_cast<int>(w_param))) {
|
| return 0;
|
| - } else if (message == WM_SETFOCUS) {
|
| - // Let the focus manager know that the focus changed.
|
| - FocusManager* focus_manager = native_control->GetFocusManager();
|
| - if (focus_manager) {
|
| - focus_manager->SetFocusedView(native_control->focus_view());
|
| - } else {
|
| - NOTREACHED();
|
| - }
|
| } else if (message == WM_DESTROY) {
|
| - win_util::SetWindowProc(window, native_control->original_wndproc_);
|
| + WNDPROC old_wndproc =
|
| + win_util::SetWindowProc(window, native_control->original_wndproc_);
|
| + DCHECK(old_wndproc == &NativeControlWin::NativeControlWndProc);
|
| }
|
|
|
| return CallWindowProc(native_control->original_wndproc_, window, message,
|
|
|