From 33b7b4f37d77a005698292ba3412af59185c6b99 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 10 Sep 2013 09:03:36 +0200 Subject: [PATCH] Bug 913953 - Part v: Remove unused HWND subclassing functions; r=ehsan --- ipc/chromium/src/base/win_util.cc | 54 ------------------------------- ipc/chromium/src/base/win_util.h | 22 ------------- 2 files changed, 76 deletions(-) diff --git a/ipc/chromium/src/base/win_util.cc b/ipc/chromium/src/base/win_util.cc index 9f968342b91..f93e3434afe 100644 --- a/ipc/chromium/src/base/win_util.cc +++ b/ipc/chromium/src/base/win_util.cc @@ -246,60 +246,6 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) { return true; } -#pragma warning(push) -#pragma warning(disable:4312 4244) -WNDPROC SetWindowProc(HWND hwnd, WNDPROC proc) { - // The reason we don't return the SetwindowLongPtr() value is that it returns - // the orignal window procedure and not the current one. I don't know if it is - // a bug or an intended feature. - WNDPROC oldwindow_proc = - reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_WNDPROC)); - SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast(proc)); - return oldwindow_proc; -} - -// Maps to the WNDPROC for a window that was active before the subclass was -// installed. -static const wchar_t* const kHandlerKey = L"__ORIGINAL_MESSAGE_HANDLER__"; - -bool IsSubclassed(HWND window, WNDPROC subclass_proc) { - WNDPROC original_handler = - reinterpret_cast(GetWindowLongPtr(window, GWLP_WNDPROC)); - return original_handler == subclass_proc; -} - -bool Subclass(HWND window, WNDPROC subclass_proc) { - WNDPROC original_handler = - reinterpret_cast(GetWindowLongPtr(window, GWLP_WNDPROC)); - if (original_handler != subclass_proc) { - win_util::SetWindowProc(window, subclass_proc); - SetProp(window, kHandlerKey, (void*)original_handler); - return true; - } - return false; -} - -bool Unsubclass(HWND window, WNDPROC subclass_proc) { - WNDPROC current_handler = - reinterpret_cast(GetWindowLongPtr(window, GWLP_WNDPROC)); - if (current_handler == subclass_proc) { - HANDLE original_handler = GetProp(window, kHandlerKey); - if (original_handler) { - RemoveProp(window, kHandlerKey); - win_util::SetWindowProc(window, - reinterpret_cast(original_handler)); - return true; - } - } - return false; -} - -WNDPROC GetSuperclassWNDPROC(HWND window) { - return reinterpret_cast(GetProp(window, kHandlerKey)); -} - -#pragma warning(pop) - bool IsShiftPressed() { return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80; } diff --git a/ipc/chromium/src/base/win_util.h b/ipc/chromium/src/base/win_util.h index 3fc049b0baa..67e5982fec0 100644 --- a/ipc/chromium/src/base/win_util.h +++ b/ipc/chromium/src/base/win_util.h @@ -51,28 +51,6 @@ bool GetUserSidString(std::wstring* user_sid); // The function returns true if it succeeds, false otherwise. 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 -// subclass procedure. -bool Subclass(HWND window, WNDPROC subclass_proc); - -// Unsubclasses a window subclassed using Subclass. Returns true if -// the window was subclassed with the specified |subclass_proc| and the window -// was successfully unsubclassed, false if the window's window procedure is not -// |subclass_proc|. -bool Unsubclass(HWND window, WNDPROC subclass_proc); - -// Retrieves the original WNDPROC of a window subclassed using -// SubclassWindow. -WNDPROC GetSuperclassWNDPROC(HWND window); - // Returns true if the shift key is currently pressed. bool IsShiftPressed();