summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/native_control.cc24
-rw-r--r--chrome/views/text_field.cc13
-rw-r--r--chrome/views/widget_win.cc3
3 files changed, 31 insertions, 9 deletions
diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc
index 3c0e8d0..1490f27 100644
--- a/chrome/views/native_control.cc
+++ b/chrome/views/native_control.cc
@@ -79,16 +79,20 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
private:
LRESULT OnCreate(LPCREATESTRUCT create_struct) {
+ TRACK_HWND_CREATION(m_hWnd);
+
control_ = parent_->CreateNativeControl(m_hWnd);
+ TRACK_HWND_CREATION(control_);
+
FocusManager::InstallFocusSubclass(control_, parent_);
- if (parent_->NotifyOnKeyDown()) {
- // We subclass the control hwnd so we get the WM_KEYDOWN messages.
- WNDPROC original_handler =
- win_util::SetWindowProc(control_,
- &NativeControl::NativeControlWndProc);
- SetProp(control_, kHandlerKey, original_handler);
- SetProp(control_, kNativeControlKey , parent_);
- }
+
+ // We subclass the control hwnd so we get the WM_KEYDOWN messages.
+ WNDPROC original_handler =
+ win_util::SetWindowProc(control_,
+ &NativeControl::NativeControlWndProc);
+ SetProp(control_, kHandlerKey, original_handler);
+ SetProp(control_, kNativeControlKey , parent_);
+
::ShowWindow(control_, SW_SHOW);
return 1;
}
@@ -121,6 +125,7 @@ class NativeControlContainer : public CWindowImpl<NativeControlContainer,
void OnDestroy() {
if (parent_)
parent_->OnDestroy();
+ TRACK_HWND_DESTRUCTION(m_hWnd);
}
void OnContextMenu(HWND window, const CPoint& location) {
@@ -363,7 +368,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message,
static_cast<NativeControl*>(GetProp(window, kNativeControlKey));
DCHECK(native_control);
- if (message == WM_KEYDOWN) {
+ if (message == WM_KEYDOWN && native_control->NotifyOnKeyDown()) {
if (native_control->OnKeyDown(static_cast<int>(w_param)))
return 0;
} else if (message == WM_DESTROY) {
@@ -371,6 +376,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message,
reinterpret_cast<WNDPROC>(original_handler));
RemoveProp(window, kHandlerKey);
RemoveProp(window, kNativeControlKey);
+ TRACK_HWND_DESTRUCTION(window);
}
return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window,
diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc
index 79ee7b9..7c4e2fd 100644
--- a/chrome/views/text_field.cc
+++ b/chrome/views/text_field.cc
@@ -70,7 +70,9 @@ class TextField::Edit
MSG_WM_CHAR(OnChar)
MSG_WM_CONTEXTMENU(OnContextMenu)
MSG_WM_COPY(OnCopy)
+ MSG_WM_CREATE(OnCreate)
MSG_WM_CUT(OnCut)
+ MSG_WM_DESTROY(OnDestroy)
MESSAGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, OnImeStartComposition)
MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeComposition)
MSG_WM_KEYDOWN(OnKeyDown)
@@ -116,7 +118,9 @@ class TextField::Edit
void OnChar(TCHAR key, UINT repeat_count, UINT flags);
void OnContextMenu(HWND window, const CPoint& point);
void OnCopy();
+ LRESULT OnCreate(CREATESTRUCT* create_struct);
void OnCut();
+ void OnDestroy();
LRESULT OnImeStartComposition(UINT message, WPARAM wparam, LPARAM lparam);
LRESULT OnImeComposition(UINT message, WPARAM wparam, LPARAM lparam);
void OnKeyDown(TCHAR key, UINT repeat_count, UINT flags);
@@ -414,6 +418,11 @@ void TextField::Edit::OnCopy() {
}
}
+LRESULT TextField::Edit::OnCreate(CREATESTRUCT* create_struct) {
+ TRACK_HWND_CREATION(m_hWnd);
+ return 0;
+}
+
void TextField::Edit::OnCut() {
if (parent_->IsReadOnly())
return;
@@ -425,6 +434,10 @@ void TextField::Edit::OnCut() {
ReplaceSel(L"", true);
}
+void TextField::Edit::OnDestroy() {
+ TRACK_HWND_DESTRUCTION(m_hWnd);
+}
+
LRESULT TextField::Edit::OnImeStartComposition(UINT message,
WPARAM wparam,
LPARAM lparam) {
diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc
index 7268a59..5e60e38 100644
--- a/chrome/views/widget_win.cc
+++ b/chrome/views/widget_win.cc
@@ -162,6 +162,8 @@ void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
window_style_, bounds.x(), bounds.y(), bounds.width(),
bounds.height(), parent, NULL, NULL, this);
DCHECK(hwnd_);
+ TRACK_HWND_CREATION(hwnd_);
+
// The window procedure should have set the data for us.
DCHECK(win_util::GetWindowUserData(hwnd_) == this);
@@ -932,6 +934,7 @@ LRESULT CALLBACK WidgetWin::WndProc(HWND window, UINT message,
if (!widget->ProcessWindowMessage(window, message, w_param, l_param, result))
result = DefWindowProc(window, message, w_param, l_param);
if (message == WM_NCDESTROY) {
+ TRACK_HWND_DESTRUCTION(window);
widget->hwnd_ = NULL;
widget->OnFinalMessage(window);
}