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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 KeyboardDeviceAddedInternal(device_info[i].deviceid, device_info[i].name); | 840 KeyboardDeviceAddedInternal(device_info[i].deviceid, device_info[i].name); |
841 } | 841 } |
842 | 842 |
843 XIFreeDeviceInfo(device_info); | 843 XIFreeDeviceInfo(device_info); |
844 #else | 844 #else |
845 KeyboardDeviceAddedInternal(device_id, "keyboard"); | 845 KeyboardDeviceAddedInternal(device_id, "keyboard"); |
846 #endif | 846 #endif |
847 } | 847 } |
848 | 848 |
849 } // namespace chromeos | 849 } // namespace chromeos |
OLD | NEW |