Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: views/controls/native_control_win.cc

Issue 214029: Adding focus to NaviteViewHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/native_control_gtk.cc ('k') | views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native_control_win.cc
===================================================================
--- views/controls/native_control_win.cc (revision 27081)
+++ views/controls/native_control_win.cc (working copy)
@@ -24,10 +24,9 @@
NativeControlWin::~NativeControlWin() {
HWND hwnd = native_view();
if (hwnd) {
- // Destroy the hwnd if it still exists. Otherwise we won't have shut things
- // down correctly, leading to leaking and crashing if another message
- // comes in for the hwnd.
- Detach();
+ // Destroy the hwnd if it still exists. Otherwise we won't shut things down
+ // correctly, leading to leaking and crashing if another message comes in
+ // for the hwnd.
DestroyWindow(hwnd);
}
}
@@ -74,9 +73,7 @@
if (!is_visible) {
// We destroy the child control HWND when we become invisible because of the
// performance cost of maintaining many HWNDs.
- HWND hwnd = native_view();
- Detach();
- DestroyWindow(hwnd);
+ DestroyWindow(native_view());
} else if (!native_view()) {
if (GetWidget())
CreateNativeControl();
@@ -117,14 +114,14 @@
// Note that we never unset this property. We don't have to.
SetProp(native_control, kNativeControlWinKey, this);
- // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages.
+ Attach(native_control);
+ // native_view() is now valid.
+
+ // Subclass so we get WM_KEYDOWN message.
original_wndproc_ =
win_util::SetWindowProc(native_control,
&NativeControlWin::NativeControlWndProc);
- Attach(native_control);
- // native_view() is now valid.
-
// Update the newly created HWND with any resident enabled state.
EnableWindow(native_view(), IsEnabled());
@@ -186,16 +183,10 @@
if (message == WM_KEYDOWN &&
native_control->OnKeyDown(static_cast<int>(w_param))) {
return 0;
- } else if (message == WM_SETFOCUS) {
- // Let the focus manager know that the focus changed.
- FocusManager* focus_manager = native_control->GetFocusManager();
- if (focus_manager) {
- focus_manager->SetFocusedView(native_control->focus_view());
- } else {
- NOTREACHED();
- }
} else if (message == WM_DESTROY) {
- win_util::SetWindowProc(window, native_control->original_wndproc_);
+ WNDPROC old_wndproc =
+ win_util::SetWindowProc(window, native_control->original_wndproc_);
+ DCHECK(old_wndproc == &NativeControlWin::NativeControlWndProc);
}
return CallWindowProc(native_control->original_wndproc_, window, message,
« no previous file with comments | « views/controls/native_control_gtk.cc ('k') | views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698