summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 21:10:32 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 21:10:32 +0000
commitf5cb25824d8c48b0d79ac7ebc1726d135d8f1966 (patch)
tree0779ea31b9a7c377f6a02e508a27c76843f50810 /base
parenta19b192312a88561389ce827765e92c1ece16bf7 (diff)
downloadchromium_src-f5cb25824d8c48b0d79ac7ebc1726d135d8f1966.zip
chromium_src-f5cb25824d8c48b0d79ac7ebc1726d135d8f1966.tar.gz
chromium_src-f5cb25824d8c48b0d79ac7ebc1726d135d8f1966.tar.bz2
Review URL: http://codereview.chromium.org/12434
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/win_util.cc6
-rw-r--r--base/win_util.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/base/win_util.cc b/base/win_util.cc
index 37c5075..cfd7f2b 100644
--- a/base/win_util.cc
+++ b/base/win_util.cc
@@ -257,6 +257,12 @@ void* GetWindowUserData(HWND hwnd) {
// installed.
static const wchar_t* const kHandlerKey = L"__ORIGINAL_MESSAGE_HANDLER__";
+bool IsSubclassed(HWND window, WNDPROC subclass_proc) {
+ WNDPROC original_handler =
+ reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC));
+ return original_handler == subclass_proc;
+}
+
bool Subclass(HWND window, WNDPROC subclass_proc) {
WNDPROC original_handler =
reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC));
diff --git a/base/win_util.h b/base/win_util.h
index 2165e62..317c332 100644
--- a/base/win_util.h
+++ b/base/win_util.h
@@ -50,6 +50,9 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor);
// Useful for subclassing a HWND. Returns the previous window procedure.
WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc);
+// Returns true if the existing window procedure is the same as |subclass_proc|.
+bool IsSubclassed(HWND window, WNDPROC subclass_proc);
+
// Subclasses a window, replacing its existing window procedure with the
// specified one. Returns true if the current window procedure was replaced,
// false if the window has already been subclassed with the specified