| 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" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 EventRewriter::DeviceType GetDeviceType(const std::string& device_name) { | 107 EventRewriter::DeviceType GetDeviceType(const std::string& device_name) { |
| 108 std::vector<std::string> tokens; | 108 std::vector<std::string> tokens; |
| 109 Tokenize(device_name, " .", &tokens); | 109 Tokenize(device_name, " .", &tokens); |
| 110 | 110 |
| 111 // If the |device_name| contains the two words, "apple" and "keyboard", treat | 111 // If the |device_name| contains the two words, "apple" and "keyboard", treat |
| 112 // it as an Apple keyboard. | 112 // it as an Apple keyboard. |
| 113 bool found_apple = false; | 113 bool found_apple = false; |
| 114 bool found_keyboard = false; | 114 bool found_keyboard = false; |
| 115 for (size_t i = 0; i < tokens.size(); ++i) { | 115 for (size_t i = 0; i < tokens.size(); ++i) { |
| 116 if (!found_apple && LowerCaseEqualsASCII(tokens[i], "apple")) | 116 if (!found_apple && base::LowerCaseEqualsASCII(tokens[i], "apple")) |
| 117 found_apple = true; | 117 found_apple = true; |
| 118 if (!found_keyboard && LowerCaseEqualsASCII(tokens[i], "keyboard")) | 118 if (!found_keyboard && base::LowerCaseEqualsASCII(tokens[i], "keyboard")) |
| 119 found_keyboard = true; | 119 found_keyboard = true; |
| 120 if (found_apple && found_keyboard) | 120 if (found_apple && found_keyboard) |
| 121 return EventRewriter::kDeviceAppleKeyboard; | 121 return EventRewriter::kDeviceAppleKeyboard; |
| 122 } | 122 } |
| 123 | 123 |
| 124 return EventRewriter::kDeviceUnknown; | 124 return EventRewriter::kDeviceUnknown; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace | 127 } // namespace |
| 128 | 128 |
| (...skipping 732 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 |