OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/controls/native_control.h" | 5 #include "ui/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 "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "ui/base/accessibility/accessibility_types.h" | 15 #include "ui/base/accessibility/accessibility_types.h" |
16 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 16 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
17 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
18 #include "ui/base/l10n/l10n_util_win.h" | 18 #include "ui/base/l10n/l10n_util_win.h" |
19 #include "ui/base/view_prop.h" | 19 #include "ui/base/view_prop.h" |
20 #include "ui/base/win/hwnd_util.h" | 20 #include "ui/gfx/win/hwnd_util.h" |
21 #include "ui/views/background.h" | 21 #include "ui/views/background.h" |
22 #include "ui/views/controls/native/native_view_host.h" | 22 #include "ui/views/controls/native/native_view_host.h" |
23 #include "ui/views/focus/focus_manager.h" | 23 #include "ui/views/focus/focus_manager.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 | 25 |
26 using ui::ViewProp; | 26 using ui::ViewProp; |
27 | 27 |
28 namespace views { | 28 namespace views { |
29 | 29 |
30 // Maps to the NativeControl. | 30 // Maps to the NativeControl. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 delete this; | 81 delete this; |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 friend class NativeControl; | 85 friend class NativeControl; |
86 | 86 |
87 LRESULT OnCreate(LPCREATESTRUCT create_struct) { | 87 LRESULT OnCreate(LPCREATESTRUCT create_struct) { |
88 control_ = parent_->CreateNativeControl(m_hWnd); | 88 control_ = parent_->CreateNativeControl(m_hWnd); |
89 | 89 |
90 // We subclass the control hwnd so we get the WM_KEYDOWN messages. | 90 // We subclass the control hwnd so we get the WM_KEYDOWN messages. |
91 original_handler_ = ui::SetWindowProc( | 91 original_handler_ = gfx::SetWindowProc( |
92 control_, &NativeControl::NativeControlWndProc); | 92 control_, &NativeControl::NativeControlWndProc); |
93 prop_.reset(new ViewProp(control_, kNativeControlKey , parent_)); | 93 prop_.reset(new ViewProp(control_, kNativeControlKey , parent_)); |
94 | 94 |
95 ::ShowWindow(control_, SW_SHOW); | 95 ::ShowWindow(control_, SW_SHOW); |
96 return 1; | 96 return 1; |
97 } | 97 } |
98 | 98 |
99 LRESULT OnEraseBkgnd(HDC dc) { | 99 LRESULT OnEraseBkgnd(HDC dc) { |
100 return 1; | 100 return 1; |
101 } | 101 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return 0; | 371 return 0; |
372 } else if (message == WM_SETFOCUS) { | 372 } else if (message == WM_SETFOCUS) { |
373 // Let the focus manager know that the focus changed. | 373 // Let the focus manager know that the focus changed. |
374 FocusManager* focus_manager = native_control->GetFocusManager(); | 374 FocusManager* focus_manager = native_control->GetFocusManager(); |
375 if (focus_manager) { | 375 if (focus_manager) { |
376 focus_manager->SetFocusedView(native_control); | 376 focus_manager->SetFocusedView(native_control); |
377 } else { | 377 } else { |
378 NOTREACHED(); | 378 NOTREACHED(); |
379 } | 379 } |
380 } else if (message == WM_DESTROY) { | 380 } else if (message == WM_DESTROY) { |
381 ui::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); | 381 gfx::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); |
382 native_control->container_->prop_.reset(); | 382 native_control->container_->prop_.reset(); |
383 } | 383 } |
384 | 384 |
385 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 385 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
386 message, w_param, l_param); | 386 message, w_param, l_param); |
387 } | 387 } |
388 | 388 |
389 } // namespace views | 389 } // namespace views |
OLD | NEW |