| 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 #include "views/focus/focus_manager.h" |
| 10 | 11 |
| 11 namespace views { | 12 namespace views { |
| 12 | 13 |
| 13 // static | 14 // static |
| 14 const wchar_t* NativeControlWin::kNativeControlWinKey = | 15 const wchar_t* NativeControlWin::kNativeControlWinKey = |
| 15 L"__NATIVE_CONTROL_WIN__"; | 16 L"__NATIVE_CONTROL_WIN__"; |
| 16 | 17 |
| 17 static const wchar_t* kNativeControlOriginalWndProcKey = | 18 static const wchar_t* kNativeControlOriginalWndProcKey = |
| 18 L"__NATIVE_CONTROL_ORIGINAL_WNDPROC__"; | 19 L"__NATIVE_CONTROL_ORIGINAL_WNDPROC__"; |
| 19 | 20 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 UINT message, | 187 UINT message, |
| 187 WPARAM w_param, | 188 WPARAM w_param, |
| 188 LPARAM l_param) { | 189 LPARAM l_param) { |
| 189 NativeControlWin* native_control = | 190 NativeControlWin* native_control = |
| 190 static_cast<NativeControlWin*>(GetProp(window, kNativeControlWinKey)); | 191 static_cast<NativeControlWin*>(GetProp(window, kNativeControlWinKey)); |
| 191 DCHECK(native_control); | 192 DCHECK(native_control); |
| 192 | 193 |
| 193 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { | 194 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { |
| 194 if (native_control->OnKeyDown(static_cast<int>(w_param))) | 195 if (native_control->OnKeyDown(static_cast<int>(w_param))) |
| 195 return 0; | 196 return 0; |
| 197 } else if (message == WM_SETFOCUS) { |
| 198 // Let the focus manager know that the focus changed. |
| 199 FocusManager* focus_manager = |
| 200 FocusManager::GetFocusManager(native_control->native_view()); |
| 201 if (focus_manager) { |
| 202 focus_manager->SetFocusedView(native_control->focus_view()); |
| 203 } else { |
| 204 NOTREACHED(); |
| 205 } |
| 196 } else if (message == WM_DESTROY) { | 206 } else if (message == WM_DESTROY) { |
| 197 win_util::SetWindowProc(window, native_control->original_wndproc_); | 207 win_util::SetWindowProc(window, native_control->original_wndproc_); |
| 198 } | 208 } |
| 199 | 209 |
| 200 return CallWindowProc(native_control->original_wndproc_, window, message, | 210 return CallWindowProc(native_control->original_wndproc_, window, message, |
| 201 w_param, l_param); | 211 w_param, l_param); |
| 202 } | 212 } |
| 203 | 213 |
| 204 } // namespace views | 214 } // namespace views |
| OLD | NEW |