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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_CHILD_WINDOW_MESSAGE_PROCESSOR_H_
6 #define UI_VIEWS_WIDGET_CHILD_WINDOW_MESSAGE_PROCESSOR_H_
16 // Windows sends a handful of messages to the parent window rather than the
17 // window itself. For example, selection changes of a rich edit (EN_SELCHANGE)
18 // are sent to the parent, not the window. Typically such message are best
19 // dealt with by the window rather than the parent. NativeWidgetWin allows for
20 // registering a ChildWindowMessageProcessor to handle such messages.
21 class ChildWindowMessageProcessor
{
23 // Registers |processor| for |hwnd|. The caller takes ownership of the
25 static ui::ViewProp
* Register(HWND hwnd
,
26 ChildWindowMessageProcessor
* processor
);
28 // Returns the ChildWindowMessageProcessor for |hwnd|, NULL if there isn't
30 static ChildWindowMessageProcessor
* Get(HWND hwnd
);
32 // Invoked for any messages that are sent to the parent and originated from
33 // the HWND this ChildWindowMessageProcessor was registered for. Returns true
34 // if the message was handled with a valid result in |result|. Returns false
35 // if the message was not handled.
36 virtual bool ProcessMessage(UINT message
,
42 virtual ~ChildWindowMessageProcessor() {}
47 #endif // UI_VIEWS_WIDGET_CHILD_WINDOW_MESSAGE_PROCESSOR_H_