| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/native_control_win.h" | 5 #include "views/controls/native_control_win.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_win.h" | 7 #include "app/l10n_util_win.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (x == -1 && y == -1) { | 105 if (x == -1 && y == -1) { |
| 106 gfx::Point point = GetKeyboardContextMenuLocation(); | 106 gfx::Point point = GetKeyboardContextMenuLocation(); |
| 107 x = point.x(); | 107 x = point.x(); |
| 108 y = point.y(); | 108 y = point.y(); |
| 109 is_mouse = false; | 109 is_mouse = false; |
| 110 } | 110 } |
| 111 View::ShowContextMenu(x, y, is_mouse); | 111 View::ShowContextMenu(x, y, is_mouse); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void NativeControlWin::NativeControlCreated(HWND native_control) { | 114 void NativeControlWin::NativeControlCreated(HWND native_control) { |
| 115 TRACK_HWND_CREATION(native_control); | |
| 116 | |
| 117 // Associate this object with the control's HWND so that WidgetWin can find | 115 // Associate this object with the control's HWND so that WidgetWin can find |
| 118 // this object when it receives messages from it. | 116 // this object when it receives messages from it. |
| 119 SetProp(native_control, kNativeControlWinKey, this); | 117 SetProp(native_control, kNativeControlWinKey, this); |
| 120 | 118 |
| 121 // Subclass the window so we can monitor for key presses. | 119 // Subclass the window so we can monitor for key presses. |
| 122 original_wndproc_ = | 120 original_wndproc_ = |
| 123 win_util::SetWindowProc(native_control, | 121 win_util::SetWindowProc(native_control, |
| 124 &NativeControlWin::NativeControlWndProc); | 122 &NativeControlWin::NativeControlWndProc); |
| 125 SetProp(native_control, kNativeControlOriginalWndProcKey, original_wndproc_); | 123 SetProp(native_control, kNativeControlOriginalWndProcKey, original_wndproc_); |
| 126 | 124 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 NativeControlWin* native_control = | 182 NativeControlWin* native_control = |
| 185 static_cast<NativeControlWin*>(GetProp(window, kNativeControlWinKey)); | 183 static_cast<NativeControlWin*>(GetProp(window, kNativeControlWinKey)); |
| 186 DCHECK(native_control); | 184 DCHECK(native_control); |
| 187 | 185 |
| 188 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { | 186 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { |
| 189 if (native_control->OnKeyDown(static_cast<int>(w_param))) | 187 if (native_control->OnKeyDown(static_cast<int>(w_param))) |
| 190 return 0; | 188 return 0; |
| 191 } else if (message == WM_DESTROY) { | 189 } else if (message == WM_DESTROY) { |
| 192 win_util::SetWindowProc(window, native_control->original_wndproc_); | 190 win_util::SetWindowProc(window, native_control->original_wndproc_); |
| 193 RemoveProp(window, kNativeControlWinKey); | 191 RemoveProp(window, kNativeControlWinKey); |
| 194 TRACK_HWND_DESTRUCTION(window); | |
| 195 } | 192 } |
| 196 | 193 |
| 197 return CallWindowProc(native_control->original_wndproc_, window, message, | 194 return CallWindowProc(native_control->original_wndproc_, window, message, |
| 198 w_param, l_param); | 195 w_param, l_param); |
| 199 } | 196 } |
| 200 | 197 |
| 201 } // namespace views | 198 } // namespace views |
| OLD | NEW |