Bug 913953 - Part v: Remove unused HWND subclassing functions; r=ehsan
authorMs2ger <ms2ger@gmail.com>
Tue, 10 Sep 2013 09:03:36 +0200
changeset 146243 3c5cf284cbb2801d157541103bd462fa22a74f99
parent 146242 f3fbd500d4760feba2f5c3d3febaff32e8ebdc7c
child 146244 ad2cf63c716f26734166d5fe4f957adef7544576
push id25250
push userMs2ger@gmail.com
push dateTue, 10 Sep 2013 07:05:27 +0000
treeherdermozilla-central@be1053dc223b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs913953
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 913953 - Part v: Remove unused HWND subclassing functions; r=ehsan
ipc/chromium/src/base/win_util.cc
ipc/chromium/src/base/win_util.h
--- a/ipc/chromium/src/base/win_util.cc
+++ b/ipc/chromium/src/base/win_util.cc
@@ -241,70 +241,16 @@ bool GetLogonSessionOnlyDACL(SECURITY_DE
       reinterpret_cast<PSECURITY_DESCRIPTOR*>(security_descriptor),
       NULL)) {
     return false;
   }
 
   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<WNDPROC>(GetWindowLongPtr(hwnd, GWLP_WNDPROC));
-  SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(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<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));
-  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<WNDPROC>(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<WNDPROC>(original_handler));
-      return true;
-    }
-  }
-  return false;
-}
-
-WNDPROC GetSuperclassWNDPROC(HWND window) {
-  return reinterpret_cast<WNDPROC>(GetProp(window, kHandlerKey));
-}
-
-#pragma warning(pop)
-
 bool IsShiftPressed() {
   return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80;
 }
 
 bool IsCtrlPressed() {
   return (::GetKeyState(VK_CONTROL) & 0x80) == 0x80;
 }
 
--- a/ipc/chromium/src/base/win_util.h
+++ b/ipc/chromium/src/base/win_util.h
@@ -46,38 +46,16 @@ bool AddAccessToKernelObject(HANDLE hand
 bool GetUserSidString(std::wstring* user_sid);
 
 // Creates a security descriptor with a DACL that has one ace giving full
 // access to the current logon session.
 // The security descriptor returned must be freed using LocalFree.
 // 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();
 
 // Returns true if the ctrl key is currently pressed.
 bool IsCtrlPressed();
 
 // Returns true if the alt key is currently pressed.
 bool IsAltPressed();