| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/sticky_keys/sticky_keys_controller.h" | 9 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| 11 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 19 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 22 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 23 #include "chromeos/ime/ime_keyboard.h" | 22 #include "chromeos/ime/ime_keyboard.h" |
| 24 #include "chromeos/ime/input_method_manager.h" | 23 #include "chromeos/ime/input_method_manager.h" |
| 24 #include "components/user_manager/user_manager.h" |
| 25 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
| 26 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 27 #include "ui/events/keycodes/keyboard_code_conversion.h" | 27 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 28 #include "ui/wm/core/window_util.h" | 28 #include "ui/wm/core/window_util.h" |
| 29 | 29 |
| 30 #if defined(USE_X11) | 30 #if defined(USE_X11) |
| 31 #include <X11/extensions/XInput2.h> | 31 #include <X11/extensions/XInput2.h> |
| 32 #include <X11/Xlib.h> | 32 #include <X11/Xlib.h> |
| 33 // Get rid of macros from Xlib.h that conflicts with other parts of the code. | 33 // Get rid of macros from Xlib.h that conflicts with other parts of the code. |
| 34 #undef RootWindow | 34 #undef RootWindow |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 key_event.type() == ui::ET_KEY_RELEASED); | 503 key_event.type() == ui::ET_KEY_RELEASED); |
| 504 | 504 |
| 505 // Do nothing if we have just logged in as guest but have not restarted chrome | 505 // Do nothing if we have just logged in as guest but have not restarted chrome |
| 506 // process yet (so we are still on the login screen). In this situations we | 506 // process yet (so we are still on the login screen). In this situations we |
| 507 // have no user profile so can not do anything useful. | 507 // have no user profile so can not do anything useful. |
| 508 // Note that currently, unlike other accounts, when user logs in as guest, we | 508 // Note that currently, unlike other accounts, when user logs in as guest, we |
| 509 // restart chrome process. In future this is to be changed. | 509 // restart chrome process. In future this is to be changed. |
| 510 // TODO(glotov): remove the following condition when we do not restart chrome | 510 // TODO(glotov): remove the following condition when we do not restart chrome |
| 511 // when user logs in as guest. | 511 // when user logs in as guest. |
| 512 // TODO(kpschoedel): check whether this is still necessary. | 512 // TODO(kpschoedel): check whether this is still necessary. |
| 513 if (UserManager::Get()->IsLoggedInAsGuest() && | 513 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() && |
| 514 LoginDisplayHostImpl::default_host()) | 514 LoginDisplayHostImpl::default_host()) |
| 515 return; | 515 return; |
| 516 | 516 |
| 517 const PrefService* pref_service = GetPrefService(); | 517 const PrefService* pref_service = GetPrefService(); |
| 518 if (!pref_service) | 518 if (!pref_service) |
| 519 return; | 519 return; |
| 520 | 520 |
| 521 MutableKeyState incoming = *state; | 521 MutableKeyState incoming = *state; |
| 522 state->flags = ui::EF_NONE; | 522 state->flags = ui::EF_NONE; |
| 523 int characteristic_flag = ui::EF_NONE; | 523 int characteristic_flag = ui::EF_NONE; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 KeyboardDeviceAddedInternal(device_info[i].deviceid, device_info[i].name); | 861 KeyboardDeviceAddedInternal(device_info[i].deviceid, device_info[i].name); |
| 862 } | 862 } |
| 863 | 863 |
| 864 XIFreeDeviceInfo(device_info); | 864 XIFreeDeviceInfo(device_info); |
| 865 #else | 865 #else |
| 866 KeyboardDeviceAddedInternal(device_id, "keyboard"); | 866 KeyboardDeviceAddedInternal(device_id, "keyboard"); |
| 867 #endif | 867 #endif |
| 868 } | 868 } |
| 869 | 869 |
| 870 } // namespace chromeos | 870 } // namespace chromeos |
| OLD | NEW |