summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 20:44:51 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-04 20:44:51 +0000
commitcd56238a0514a66c4ecdd9ef9c49a49198656914 (patch)
treeed4257477acdac715e26edb5cf21726ae15b8d81 /views/controls
parentf9889ed8c9fc841f29a99c813205ce37b1c08ffb (diff)
downloadchromium_src-cd56238a0514a66c4ecdd9ef9c49a49198656914.zip
chromium_src-cd56238a0514a66c4ecdd9ef9c49a49198656914.tar.gz
chromium_src-cd56238a0514a66c4ecdd9ef9c49a49198656914.tar.bz2
Adds the ability for classes other than native control to process
messages bounced to the parent and wires it up for autocompleteedit, which I'm going to need shortly. BUG=none TEST=none Review URL: http://codereview.chromium.org/4470001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/native_control_win.cc15
-rw-r--r--views/controls/native_control_win.h18
2 files changed, 16 insertions, 17 deletions
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc
index 0c6d257..c4f811c 100644
--- a/views/controls/native_control_win.cc
+++ b/views/controls/native_control_win.cc
@@ -14,9 +14,7 @@
namespace views {
-// static
-const wchar_t* NativeControlWin::kNativeControlWinKey =
- L"__NATIVE_CONTROL_WIN__";
+static const wchar_t* kNativeControlWinKey = L"__NATIVE_CONTROL_WIN__";
////////////////////////////////////////////////////////////////////////////////
// NativeControlWin, public:
@@ -35,8 +33,10 @@ NativeControlWin::~NativeControlWin() {
}
}
-bool NativeControlWin::ProcessMessage(UINT message, WPARAM w_param,
- LPARAM l_param, LRESULT* result) {
+bool NativeControlWin::ProcessMessage(UINT message,
+ WPARAM w_param,
+ LPARAM l_param,
+ LRESULT* result) {
switch (message) {
case WM_CONTEXTMENU:
ShowContextMenu(gfx::Point(GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param)));
@@ -130,8 +130,9 @@ void NativeControlWin::ShowContextMenu(const gfx::Point& location) {
void NativeControlWin::NativeControlCreated(HWND native_control) {
// Associate this object with the control's HWND so that WidgetWin can find
// this object when it receives messages from it.
- prop_.reset(
+ props_.push_back(
new app::win::ScopedProp(native_control, kNativeControlWinKey, this));
+ props_.push_back(ChildWindowMessageProcessor::Register(native_control, this));
// Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages.
original_wndproc_ =
@@ -211,7 +212,7 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window,
NOTREACHED();
}
} else if (message == WM_DESTROY) {
- native_control->prop_.reset();
+ native_control->props_.reset();
win_util::SetWindowProc(window, native_control->original_wndproc_);
}
diff --git a/views/controls/native_control_win.h b/views/controls/native_control_win.h
index 6d0fdf0..3733a15 100644
--- a/views/controls/native_control_win.h
+++ b/views/controls/native_control_win.h
@@ -7,8 +7,10 @@
#pragma once
#include "base/scoped_ptr.h"
+#include "base/scoped_vector.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/native/native_view_host.h"
+#include "views/widget/child_window_message_processor.h"
namespace app {
namespace win {
@@ -19,19 +21,13 @@ class ScopedProp;
namespace views {
// A View that hosts a native Windows control.
-class NativeControlWin : public NativeViewHost {
+class NativeControlWin : public ChildWindowMessageProcessor,
+ public NativeViewHost {
public:
- static const wchar_t* kNativeControlWinKey;
-
NativeControlWin();
virtual ~NativeControlWin();
- // Called by the containing WidgetWin when a message is received from the HWND
- // created by an object derived from NativeControlWin. Derived classes MUST
- // call _this_ version of the function if they override it and do not handle
- // all of the messages listed in widget_win.cc ProcessNativeControlWinMessage.
- // Returns true if the message was handled, with a valid result in |result|.
- // Returns false if the message was not handled.
+ // Overridden from ChildWindowMessageProcessor:
virtual bool ProcessMessage(UINT message,
WPARAM w_param,
LPARAM l_param,
@@ -79,6 +75,8 @@ class NativeControlWin : public NativeViewHost {
DWORD GetAdditionalRTLStyle() const;
private:
+ typedef ScopedVector<app::win::ScopedProp> ScopedProps;
+
// Called by the containing WidgetWin when a message of type WM_CTLCOLORBTN or
// WM_CTLCOLORSTATIC is sent from the HWND created by an object dreived from
// NativeControlWin.
@@ -93,7 +91,7 @@ class NativeControlWin : public NativeViewHost {
// The window procedure before we subclassed.
WNDPROC original_wndproc_;
- scoped_ptr<app::win::ScopedProp> prop_;
+ ScopedProps props_;
DISALLOW_COPY_AND_ASSIGN(NativeControlWin);
};