| 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"; |
| 282 win_util::SetWindowProc(window, subclass_proc); | 284 win_util::SetWindowProc(window, subclass_proc); |
| 283 SetProp(window, kHandlerKey, original_handler); | 285 SetProp(window, kHandlerKey, original_handler); |
| 284 return true; | 286 return true; |
| 285 } | 287 } |
| 286 return false; | 288 return false; |
| 287 } | 289 } |
| 288 | 290 |
| 289 bool Unsubclass(HWND window, WNDPROC subclass_proc) { | 291 bool Unsubclass(HWND window, WNDPROC subclass_proc) { |
| 290 WNDPROC current_handler = | 292 WNDPROC current_handler = |
| 291 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); | 293 reinterpret_cast<WNDPROC>(GetWindowLongPtr(window, GWLP_WNDPROC)); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 391 |
| 390 #ifndef COPY_FILE_COPY_SYMLINK | 392 #ifndef COPY_FILE_COPY_SYMLINK |
| 391 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 393 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
| 392 set it as your default include path to build this library. You can grab it by \ | 394 set it as your default include path to build this library. You can grab it by \ |
| 393 searching for "download windows sdk 2008" in your favorite web search engine. \ | 395 searching for "download windows sdk 2008" in your favorite web search engine. \ |
| 394 Also make sure you register the SDK with Visual Studio, by selecting \ | 396 Also make sure you register the SDK with Visual Studio, by selecting \ |
| 395 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 397 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
| 396 menu (see Start - All Programs - Microsoft Windows SDK - \ | 398 menu (see Start - All Programs - Microsoft Windows SDK - \ |
| 397 Visual Studio Registration). | 399 Visual Studio Registration). |
| 398 #endif | 400 #endif |
| OLD | NEW |