| 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 #ifndef CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ | 6 #define CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "ash/event_rewriter_delegate.h" | 12 #include "ash/event_rewriter_delegate.h" |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "ui/aura/root_window_observer.h" | 17 #include "ui/aura/root_window_observer.h" |
| 17 #include "ui/events/keycodes/keyboard_codes.h" | 18 #include "ui/events/keycodes/keyboard_codes.h" |
| 18 | 19 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void set_xkeyboard_for_testing(chromeos::input_method::XKeyboard* xkeyboard) { | 72 void set_xkeyboard_for_testing(chromeos::input_method::XKeyboard* xkeyboard) { |
| 72 xkeyboard_for_testing_ = xkeyboard; | 73 xkeyboard_for_testing_ = xkeyboard; |
| 73 } | 74 } |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 76 // Gets DeviceType from the |device_name|. | 77 // Gets DeviceType from the |device_name|. |
| 77 static DeviceType GetDeviceType(const std::string& device_name); | 78 static DeviceType GetDeviceType(const std::string& device_name); |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 friend class EventRewriterAshTest; | 81 friend class EventRewriterAshTest; |
| 82 friend class EventRewriterTest; |
| 81 | 83 |
| 82 // ash::EventRewriterDelegate overrides: | 84 // ash::EventRewriterDelegate overrides: |
| 83 virtual ash::EventRewriterDelegate::Action RewriteOrFilterKeyEvent( | 85 virtual ash::EventRewriterDelegate::Action RewriteOrFilterKeyEvent( |
| 84 ui::KeyEvent* event) OVERRIDE; | 86 ui::KeyEvent* event) OVERRIDE; |
| 85 virtual ash::EventRewriterDelegate::Action RewriteOrFilterLocatedEvent( | 87 virtual ash::EventRewriterDelegate::Action RewriteOrFilterLocatedEvent( |
| 86 ui::LocatedEvent* event) OVERRIDE; | 88 ui::LocatedEvent* event) OVERRIDE; |
| 87 | 89 |
| 88 // aura::RootWindowObserver overrides: | 90 // aura::RootWindowObserver overrides: |
| 89 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE; | 91 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE; |
| 90 | 92 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 int* remapped_flags, | 218 int* remapped_flags, |
| 217 unsigned int* remapped_native_modifiers) const; | 219 unsigned int* remapped_native_modifiers) const; |
| 218 | 220 |
| 219 std::map<int, DeviceType> device_id_to_type_; | 221 std::map<int, DeviceType> device_id_to_type_; |
| 220 int last_device_id_; | 222 int last_device_id_; |
| 221 | 223 |
| 222 #if defined(OS_CHROMEOS) | 224 #if defined(OS_CHROMEOS) |
| 223 // A mapping from X11 KeySym keys to KeyCode values. | 225 // A mapping from X11 KeySym keys to KeyCode values. |
| 224 base::hash_map<unsigned long, unsigned long> keysym_to_keycode_map_; | 226 base::hash_map<unsigned long, unsigned long> keysym_to_keycode_map_; |
| 225 | 227 |
| 228 // A set of device IDs whose press event has been rewritten. |
| 229 std::set<int> pressed_device_ids_; |
| 230 |
| 226 chromeos::input_method::XKeyboard* xkeyboard_for_testing_; | 231 chromeos::input_method::XKeyboard* xkeyboard_for_testing_; |
| 227 | 232 |
| 228 scoped_ptr<chromeos::KeyboardDrivenEventRewriter> | 233 scoped_ptr<chromeos::KeyboardDrivenEventRewriter> |
| 229 keyboard_driven_event_rewriter_; | 234 keyboard_driven_event_rewriter_; |
| 230 #endif | 235 #endif |
| 231 | 236 |
| 232 const PrefService* pref_service_for_testing_; | 237 const PrefService* pref_service_for_testing_; |
| 233 | 238 |
| 234 DISALLOW_COPY_AND_ASSIGN(EventRewriter); | 239 DISALLOW_COPY_AND_ASSIGN(EventRewriter); |
| 235 }; | 240 }; |
| 236 | 241 |
| 237 #endif // CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ | 242 #endif // CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ |
| OLD | NEW |