| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/ui_controls_internal_win.h" | 5 #include "chrome/test/base/ui_controls_internal_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Uninstalls the hook set in InstallHook. | 104 // Uninstalls the hook set in InstallHook. |
| 105 void UninstallHook(InputDispatcher* dispatcher) { | 105 void UninstallHook(InputDispatcher* dispatcher) { |
| 106 if (current_dispatcher_ == dispatcher) { | 106 if (current_dispatcher_ == dispatcher) { |
| 107 installed_hook_ = false; | 107 installed_hook_ = false; |
| 108 current_dispatcher_ = NULL; | 108 current_dispatcher_ = NULL; |
| 109 UnhookWindowsHookEx(next_hook_); | 109 UnhookWindowsHookEx(next_hook_); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 InputDispatcher::InputDispatcher(const base::Closure& task, | 113 InputDispatcher::InputDispatcher(const base::Closure& task, |
| 114 UINT message_waiting_for) | 114 WPARAM message_waiting_for) |
| 115 : task_(task), message_waiting_for_(message_waiting_for) { | 115 : task_(task), message_waiting_for_(message_waiting_for) { |
| 116 InstallHook(this, message_waiting_for == WM_KEYUP); | 116 InstallHook(this, message_waiting_for == WM_KEYUP); |
| 117 } | 117 } |
| 118 | 118 |
| 119 InputDispatcher::~InputDispatcher() { | 119 InputDispatcher::~InputDispatcher() { |
| 120 // Make sure the hook isn't installed. | 120 // Make sure the hook isn't installed. |
| 121 UninstallHook(this); | 121 UninstallHook(this); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void InputDispatcher::DispatchedMessage(WPARAM message) { | 124 void InputDispatcher::DispatchedMessage(WPARAM message) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return false; | 338 return false; |
| 339 | 339 |
| 340 if (dispatcher.get()) | 340 if (dispatcher.get()) |
| 341 dispatcher->AddRef(); | 341 dispatcher->AddRef(); |
| 342 | 342 |
| 343 return true; | 343 return true; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace internal | 346 } // namespace internal |
| 347 } // namespace ui_controls | 347 } // namespace ui_controls |
| OLD | NEW |