OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input_method/input_method_engine.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
6 | 6 |
7 #undef FocusIn | 7 #undef FocusIn |
8 #undef FocusOut | 8 #undef FocusOut |
9 #undef RootWindow | 9 #undef RootWindow |
10 #include <map> | 10 #include <map> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 while (*s) { | 65 while (*s) { |
66 if ((*s & 0xC0) != 0x80) | 66 if ((*s & 0xC0) != 0x80) |
67 ret++; | 67 ret++; |
68 ++s; | 68 ++s; |
69 } | 69 } |
70 return ret; | 70 return ret; |
71 } | 71 } |
72 | 72 |
73 std::string GetKeyFromEvent(const ui::KeyEvent& event) { | 73 std::string GetKeyFromEvent(const ui::KeyEvent& event) { |
74 const std::string code = event.GetCodeString(); | 74 const std::string code = event.GetCodeString(); |
75 if (base::StartsWithASCII(code, "Control", true)) | 75 if (base::StartsWith(code, "Control", base::CompareCase::SENSITIVE)) |
76 return "Ctrl"; | 76 return "Ctrl"; |
77 if (base::StartsWithASCII(code, "Shift", true)) | 77 if (base::StartsWith(code, "Shift", base::CompareCase::SENSITIVE)) |
78 return "Shift"; | 78 return "Shift"; |
79 if (base::StartsWithASCII(code, "Alt", true)) | 79 if (base::StartsWith(code, "Alt", base::CompareCase::SENSITIVE)) |
80 return "Alt"; | 80 return "Alt"; |
81 if (base::StartsWithASCII(code, "Arrow", true)) | 81 if (base::StartsWith(code, "Arrow", base::CompareCase::SENSITIVE)) |
82 return code.substr(5); | 82 return code.substr(5); |
83 if (code == "Escape") | 83 if (code == "Escape") |
84 return "Esc"; | 84 return "Esc"; |
85 if (code == "Backspace" || code == "Tab" || | 85 if (code == "Backspace" || code == "Tab" || |
86 code == "Enter" || code == "CapsLock" || | 86 code == "Enter" || code == "CapsLock" || |
87 code == "Power") | 87 code == "Power") |
88 return code; | 88 return code; |
89 // Cases for media keys. | 89 // Cases for media keys. |
90 switch (event.key_code()) { | 90 switch (event.key_code()) { |
91 case ui::VKEY_BROWSER_BACK: | 91 case ui::VKEY_BROWSER_BACK: |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // TODO(nona): Implement it. | 706 // TODO(nona): Implement it. |
707 break; | 707 break; |
708 } | 708 } |
709 } | 709 } |
710 } | 710 } |
711 | 711 |
712 // TODO(nona): Support item.children. | 712 // TODO(nona): Support item.children. |
713 } | 713 } |
714 | 714 |
715 } // namespace chromeos | 715 } // namespace chromeos |
OLD | NEW |