Index: chrome/browser/autocomplete/autocomplete_edit_view_win.cc |
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc |
index e853c85dd51c24cf371d254d679f8ba5b382a533..b76a2b5a7e526657cc432a1b8ac92db17cfc4f70 100644 |
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc |
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc |
@@ -22,6 +22,7 @@ |
#include "app/win/drag_source.h" |
#include "app/win/drop_target.h" |
#include "app/win/iat_patch_function.h" |
+#include "app/win/scoped_prop.h" |
#include "base/auto_reset.h" |
#include "base/basictypes.h" |
#include "base/i18n/rtl.h" |
@@ -438,6 +439,10 @@ AutocompleteEditViewWin::AutocompleteEditViewWin( |
SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, |
reinterpret_cast<LPARAM>(&WordBreakProc)); |
+ // Makes it EN_SELCHANGE is sent to our parent window and back to us by way of |
+ // ProcessWindowMessage. |
+ SetEventMask(ENM_SELCHANGE); |
+ |
// Get the metrics for the font. |
HDC dc = ::GetDC(NULL); |
SelectObject(dc, font_.GetNativeFont()); |
@@ -468,6 +473,9 @@ AutocompleteEditViewWin::AutocompleteEditViewWin( |
SetBackgroundColor(background_color_); |
+ message_handler_prop_.reset( |
+ views::ChildWindowMessageProcessor::Register(m_hWnd, this)); |
+ |
// By default RichEdit has a drop target. Revoke it so that we can install our |
// own. Revoke takes care of deleting the existing one. |
RevokeDragDrop(m_hWnd); |
@@ -1056,6 +1064,19 @@ void AutocompleteEditViewWin::ExecuteCommand(int command_id) { |
OnAfterPossibleChange(); |
} |
+bool AutocompleteEditViewWin::ProcessMessage(UINT message, |
+ WPARAM w_param, |
+ LPARAM l_param, |
+ LRESULT* result) { |
+ if (message == WM_NOTIFY) { |
+ NMHDR* header = reinterpret_cast<NMHDR*>(l_param); |
+ if (header->code == EN_SELCHANGE) { |
+ // TODO(sky): wire this up. |
+ } |
+ } |
+ return false; |
+} |
+ |
// static |
int CALLBACK AutocompleteEditViewWin::WordBreakProc(LPTSTR edit_text, |
int current_pos, |
@@ -1246,6 +1267,10 @@ void AutocompleteEditViewWin::OnCut() { |
ReplaceSel(L"", true); |
} |
+void AutocompleteEditViewWin::OnDestroy() { |
+ message_handler_prop_.reset(); |
+} |
+ |
LRESULT AutocompleteEditViewWin::OnGetObject(UINT uMsg, |
WPARAM wparam, |
LPARAM lparam) { |