| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/controls/native_control.h" | 5 #include "views/controls/native_control.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atlcrack.h> | 9 #include <atlcrack.h> |
| 10 #include <atlframe.h> | 10 #include <atlframe.h> |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DCHECK(original_handler); | 360 DCHECK(original_handler); |
| 361 NativeControl* native_control = | 361 NativeControl* native_control = |
| 362 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); | 362 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); |
| 363 DCHECK(native_control); | 363 DCHECK(native_control); |
| 364 | 364 |
| 365 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { | 365 if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) { |
| 366 if (native_control->OnKeyDown(static_cast<int>(w_param))) | 366 if (native_control->OnKeyDown(static_cast<int>(w_param))) |
| 367 return 0; | 367 return 0; |
| 368 } else if (message == WM_SETFOCUS) { | 368 } else if (message == WM_SETFOCUS) { |
| 369 // Let the focus manager know that the focus changed. | 369 // Let the focus manager know that the focus changed. |
| 370 FocusManager* focus_manager = native_control->GetFocusManager(); | 370 FocusManager* focus_manager = |
| 371 FocusManager::GetFocusManager(native_control->GetNativeControlHWND()); |
| 371 if (focus_manager) { | 372 if (focus_manager) { |
| 372 focus_manager->SetFocusedView(native_control); | 373 focus_manager->SetFocusedView(native_control); |
| 373 } else { | 374 } else { |
| 374 NOTREACHED(); | 375 NOTREACHED(); |
| 375 } | 376 } |
| 376 } else if (message == WM_DESTROY) { | 377 } else if (message == WM_DESTROY) { |
| 377 win_util::SetWindowProc(window, | 378 win_util::SetWindowProc(window, |
| 378 reinterpret_cast<WNDPROC>(original_handler)); | 379 reinterpret_cast<WNDPROC>(original_handler)); |
| 379 RemoveProp(window, kHandlerKey); | 380 RemoveProp(window, kHandlerKey); |
| 380 RemoveProp(window, kNativeControlKey); | 381 RemoveProp(window, kNativeControlKey); |
| 381 } | 382 } |
| 382 | 383 |
| 383 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 384 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
| 384 message, w_param, l_param); | 385 message, w_param, l_param); |
| 385 } | 386 } |
| 386 | 387 |
| 387 } // namespace views | 388 } // namespace views |
| OLD | NEW |