| 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/chromeos/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/sticky_keys/sticky_keys_controller.h" | 12 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 13 #include "ash/wm/window_state_aura.h" | |
| 14 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/macros.h" | 16 #include "base/macros.h" |
| 18 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 20 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 20 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 22 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 21 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 LOG(ERROR) << "Device ID " << last_keyboard_device_id_ << " is unknown."; | 417 LOG(ERROR) << "Device ID " << last_keyboard_device_id_ << " is unknown."; |
| 419 return false; | 418 return false; |
| 420 } | 419 } |
| 421 | 420 |
| 422 const DeviceType type = iter->second; | 421 const DeviceType type = iter->second; |
| 423 return type == device_type; | 422 return type == device_type; |
| 424 } | 423 } |
| 425 | 424 |
| 426 bool EventRewriter::TopRowKeysAreFunctionKeys(const ui::KeyEvent& event) const { | 425 bool EventRewriter::TopRowKeysAreFunctionKeys(const ui::KeyEvent& event) const { |
| 427 const PrefService* prefs = GetPrefService(); | 426 const PrefService* prefs = GetPrefService(); |
| 428 if (prefs && prefs->FindPreference(prefs::kLanguageSendFunctionKeys) && | 427 return prefs && prefs->FindPreference(prefs::kLanguageSendFunctionKeys) && |
| 429 prefs->GetBoolean(prefs::kLanguageSendFunctionKeys)) | 428 prefs->GetBoolean(prefs::kLanguageSendFunctionKeys); |
| 430 return true; | |
| 431 | |
| 432 ash::wm::WindowState* state = ash::wm::GetActiveWindowState(); | |
| 433 return state ? state->top_row_keys_are_function_keys() : false; | |
| 434 } | 429 } |
| 435 | 430 |
| 436 int EventRewriter::GetRemappedModifierMasks(const PrefService& pref_service, | 431 int EventRewriter::GetRemappedModifierMasks(const PrefService& pref_service, |
| 437 const ui::Event& event, | 432 const ui::Event& event, |
| 438 int original_flags) const { | 433 int original_flags) const { |
| 439 int unmodified_flags = original_flags; | 434 int unmodified_flags = original_flags; |
| 440 int rewritten_flags = pressed_modifier_latches_ | latched_modifier_latches_; | 435 int rewritten_flags = pressed_modifier_latches_ | latched_modifier_latches_; |
| 441 for (size_t i = 0; unmodified_flags && (i < arraysize(kModifierRemappings)); | 436 for (size_t i = 0; unmodified_flags && (i < arraysize(kModifierRemappings)); |
| 442 ++i) { | 437 ++i) { |
| 443 const ModifierRemapping* remapped_key = NULL; | 438 const ModifierRemapping* remapped_key = NULL; |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 for (const auto& keyboard : keyboard_devices) { | 1142 for (const auto& keyboard : keyboard_devices) { |
| 1148 if (keyboard.id == device_id) { | 1143 if (keyboard.id == device_id) { |
| 1149 return KeyboardDeviceAddedInternal( | 1144 return KeyboardDeviceAddedInternal( |
| 1150 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 1145 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
| 1151 } | 1146 } |
| 1152 } | 1147 } |
| 1153 return kDeviceUnknown; | 1148 return kDeviceUnknown; |
| 1154 } | 1149 } |
| 1155 | 1150 |
| 1156 } // namespace chromeos | 1151 } // namespace chromeos |
| OLD | NEW |