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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 EventRewriter::DeviceType GetDeviceType(const std::string& device_name, | 140 EventRewriter::DeviceType GetDeviceType(const std::string& device_name, |
141 int vendor_id, | 141 int vendor_id, |
142 int product_id) { | 142 int product_id) { |
143 if (vendor_id == kHotrodRemoteVendorId && | 143 if (vendor_id == kHotrodRemoteVendorId && |
144 product_id == kHotrodRemoteProductId) { | 144 product_id == kHotrodRemoteProductId) { |
145 return EventRewriter::kDeviceHotrodRemote; | 145 return EventRewriter::kDeviceHotrodRemote; |
146 } | 146 } |
147 | 147 |
148 if (LowerCaseEqualsASCII(device_name, "virtual core keyboard")) | 148 if (base::LowerCaseEqualsASCII(device_name, "virtual core keyboard")) |
149 return EventRewriter::kDeviceVirtualCoreKeyboard; | 149 return EventRewriter::kDeviceVirtualCoreKeyboard; |
150 | 150 |
151 std::vector<std::string> tokens; | 151 std::vector<std::string> tokens; |
152 Tokenize(device_name, " .", &tokens); | 152 Tokenize(device_name, " .", &tokens); |
153 | 153 |
154 | 154 |
155 // If the |device_name| contains the two words, "apple" and "keyboard", treat | 155 // If the |device_name| contains the two words, "apple" and "keyboard", treat |
156 // it as an Apple keyboard. | 156 // it as an Apple keyboard. |
157 bool found_apple = false; | 157 bool found_apple = false; |
158 bool found_keyboard = false; | 158 bool found_keyboard = false; |
159 for (size_t i = 0; i < tokens.size(); ++i) { | 159 for (size_t i = 0; i < tokens.size(); ++i) { |
160 if (!found_apple && LowerCaseEqualsASCII(tokens[i], "apple")) | 160 if (!found_apple && base::LowerCaseEqualsASCII(tokens[i], "apple")) |
161 found_apple = true; | 161 found_apple = true; |
162 if (!found_keyboard && LowerCaseEqualsASCII(tokens[i], "keyboard")) | 162 if (!found_keyboard && base::LowerCaseEqualsASCII(tokens[i], "keyboard")) |
163 found_keyboard = true; | 163 found_keyboard = true; |
164 if (found_apple && found_keyboard) | 164 if (found_apple && found_keyboard) |
165 return EventRewriter::kDeviceAppleKeyboard; | 165 return EventRewriter::kDeviceAppleKeyboard; |
166 } | 166 } |
167 | 167 |
168 return EventRewriter::kDeviceUnknown; | 168 return EventRewriter::kDeviceUnknown; |
169 } | 169 } |
170 | 170 |
171 } // namespace | 171 } // namespace |
172 | 172 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 for (const auto& keyboard : keyboards) { | 947 for (const auto& keyboard : keyboards) { |
948 if (keyboard.id == device_id) { | 948 if (keyboard.id == device_id) { |
949 return KeyboardDeviceAddedInternal( | 949 return KeyboardDeviceAddedInternal( |
950 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 950 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
951 } | 951 } |
952 } | 952 } |
953 return kDeviceUnknown; | 953 return kDeviceUnknown; |
954 } | 954 } |
955 | 955 |
956 } // namespace chromeos | 956 } // namespace chromeos |
OLD | NEW |