OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
11 #include <atlmisc.h> | 11 #include <atlmisc.h> |
12 | 12 |
| 13 #include "app/keyboard_code_conversion_win.h" |
| 14 #include "app/keyboard_codes.h" |
13 #include "app/l10n_util_win.h" | 15 #include "app/l10n_util_win.h" |
14 #include "base/keyboard_codes.h" | |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/win_util.h" | 17 #include "base/win_util.h" |
17 #include "gfx/native_theme_win.h" | 18 #include "gfx/native_theme_win.h" |
18 #include "views/background.h" | 19 #include "views/background.h" |
19 #include "views/border.h" | 20 #include "views/border.h" |
20 #include "views/controls/native/native_view_host.h" | 21 #include "views/controls/native/native_view_host.h" |
21 #include "views/focus/focus_manager.h" | 22 #include "views/focus/focus_manager.h" |
22 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
23 | 24 |
24 namespace views { | 25 namespace views { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, | 353 LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, |
353 WPARAM w_param, | 354 WPARAM w_param, |
354 LPARAM l_param) { | 355 LPARAM l_param) { |
355 HANDLE original_handler = GetProp(window, kHandlerKey); | 356 HANDLE original_handler = GetProp(window, kHandlerKey); |
356 DCHECK(original_handler); | 357 DCHECK(original_handler); |
357 NativeControl* native_control = | 358 NativeControl* native_control = |
358 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); | 359 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); |
359 DCHECK(native_control); | 360 DCHECK(native_control); |
360 | 361 |
361 if (message == WM_KEYDOWN && | 362 if (message == WM_KEYDOWN && |
362 native_control->OnKeyDown(win_util::WinToKeyboardCode(w_param))) { | 363 native_control->OnKeyDown(app::KeyboardCodeForWindowsKeyCode(w_param))) { |
363 return 0; | 364 return 0; |
364 } else if (message == WM_SETFOCUS) { | 365 } else if (message == WM_SETFOCUS) { |
365 // Let the focus manager know that the focus changed. | 366 // Let the focus manager know that the focus changed. |
366 FocusManager* focus_manager = native_control->GetFocusManager(); | 367 FocusManager* focus_manager = native_control->GetFocusManager(); |
367 if (focus_manager) { | 368 if (focus_manager) { |
368 focus_manager->SetFocusedView(native_control); | 369 focus_manager->SetFocusedView(native_control); |
369 } else { | 370 } else { |
370 NOTREACHED(); | 371 NOTREACHED(); |
371 } | 372 } |
372 } else if (message == WM_DESTROY) { | 373 } else if (message == WM_DESTROY) { |
373 win_util::SetWindowProc(window, | 374 win_util::SetWindowProc(window, |
374 reinterpret_cast<WNDPROC>(original_handler)); | 375 reinterpret_cast<WNDPROC>(original_handler)); |
375 RemoveProp(window, kHandlerKey); | 376 RemoveProp(window, kHandlerKey); |
376 RemoveProp(window, kNativeControlKey); | 377 RemoveProp(window, kNativeControlKey); |
377 } | 378 } |
378 | 379 |
379 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 380 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
380 message, w_param, l_param); | 381 message, w_param, l_param); |
381 } | 382 } |
382 | 383 |
383 } // namespace views | 384 } // namespace views |
OLD | NEW |