| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/win_util.h" | 5 #include "base/win_util.h" |
| 6 | 6 |
| 7 #include <sddl.h> | 7 #include <sddl.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/registry.h" | 10 #include "base/registry.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 bool IsSubclassed(HWND window, WNDPROC subclass_proc) { | 272 bool IsSubclassed(HWND window, WNDPROC subclass_proc) { |
| 273 WNDPROC original_handler = | 273 WNDPROC original_handler = |
| 274 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 274 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
| 275 return original_handler == subclass_proc; | 275 return original_handler == subclass_proc; |
| 276 } | 276 } |
| 277 | 277 |
| 278 bool Subclass(HWND window, WNDPROC subclass_proc) { | 278 bool Subclass(HWND window, WNDPROC subclass_proc) { |
| 279 WNDPROC original_handler = | 279 WNDPROC original_handler = |
| 280 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 280 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
| 281 if (original_handler != subclass_proc) { | 281 if (original_handler != subclass_proc) { |
| 282 DCHECK(!GetProp(window, kHandlerKey)) << "subclassing a HWND more than " | |
| 283 "once"; | |
| 284 win_util::SetWindowProc(window, subclass_proc); | 282 win_util::SetWindowProc(window, subclass_proc); |
| 285 SetProp(window, kHandlerKey, original_handler); | 283 SetProp(window, kHandlerKey, original_handler); |
| 286 return true; | 284 return true; |
| 287 } | 285 } |
| 288 return false; | 286 return false; |
| 289 } | 287 } |
| 290 | 288 |
| 291 bool Unsubclass(HWND window, WNDPROC subclass_proc) { | 289 bool Unsubclass(HWND window, WNDPROC subclass_proc) { |
| 292 WNDPROC current_handler = | 290 WNDPROC current_handler = |
| 293 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 291 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 397 |
| 400 #ifndef COPY_FILE_COPY_SYMLINK | 398 #ifndef COPY_FILE_COPY_SYMLINK |
| 401 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 399 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
| 402 set it as your default include path to build this library. You can grab it by \ | 400 set it as your default include path to build this library. You can grab it by \ |
| 403 searching for "download windows sdk 2008" in your favorite web search engine. \ | 401 searching for "download windows sdk 2008" in your favorite web search engine. \ |
| 404 Also make sure you register the SDK with Visual Studio, by selecting \ | 402 Also make sure you register the SDK with Visual Studio, by selecting \ |
| 405 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 403 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
| 406 menu (see Start - All Programs - Microsoft Windows SDK - \ | 404 menu (see Start - All Programs - Microsoft Windows SDK - \ |
| 407 Visual Studio Registration). | 405 Visual Studio Registration). |
| 408 #endif | 406 #endif |
| OLD | NEW |