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