OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/ui/views/apps/keyboard_hook_handler.h" | 5 #include "chrome/browser/ui/views/apps/keyboard_hook_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 UINT restore_keyboard_state_message_id_; | 203 UINT restore_keyboard_state_message_id_; |
204 | 204 |
205 // Private message to inject keyboard event after current injected message is | 205 // Private message to inject keyboard event after current injected message is |
206 // processed. | 206 // processed. |
207 UINT inject_keyboard_event_message_id_; | 207 UINT inject_keyboard_event_message_id_; |
208 | 208 |
209 // There is no lock protecting this list as the low level hook callbacks are | 209 // There is no lock protecting this list as the low level hook callbacks are |
210 // executed on same thread that registered the hook and there is only one | 210 // executed on same thread that registered the hook and there is only one |
211 // thread | 211 // thread |
212 // that execute all view code in browser. | 212 // that execute all view code in browser. |
213 base::ScopedPtrHashMap<HWND, KeyboardInterceptRegistration> registrations_; | 213 base::ScopedPtrHashMap<HWND, scoped_ptr<KeyboardInterceptRegistration>> |
| 214 registrations_; |
214 | 215 |
215 DISALLOW_COPY_AND_ASSIGN(LowLevelHookHandler); | 216 DISALLOW_COPY_AND_ASSIGN(LowLevelHookHandler); |
216 }; | 217 }; |
217 | 218 |
218 KeyboardInterceptRegistration::KeyboardInterceptRegistration() { | 219 KeyboardInterceptRegistration::KeyboardInterceptRegistration() { |
219 } | 220 } |
220 | 221 |
221 bool KeyboardInterceptRegistration::IsKeyboardEventQueueEmpty() { | 222 bool KeyboardInterceptRegistration::IsKeyboardEventQueueEmpty() { |
222 return keyboard_events_.empty(); | 223 return keyboard_events_.empty(); |
223 } | 224 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 DefaultSingletonTraits<KeyboardHookHandler>>::get(); | 420 DefaultSingletonTraits<KeyboardHookHandler>>::get(); |
420 } | 421 } |
421 | 422 |
422 void KeyboardHookHandler::Register(views::Widget* widget) { | 423 void KeyboardHookHandler::Register(views::Widget* widget) { |
423 LowLevelHookHandler::GetInstance()->Register(GetWindowHandle(widget)); | 424 LowLevelHookHandler::GetInstance()->Register(GetWindowHandle(widget)); |
424 } | 425 } |
425 | 426 |
426 void KeyboardHookHandler::Deregister(views::Widget* widget) { | 427 void KeyboardHookHandler::Deregister(views::Widget* widget) { |
427 LowLevelHookHandler::GetInstance()->Deregister(GetWindowHandle(widget)); | 428 LowLevelHookHandler::GetInstance()->Deregister(GetWindowHandle(widget)); |
428 } | 429 } |
OLD | NEW |