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 "ui/base/ime/chromeos/input_method_descriptor.h" | 5 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // TODO(nona): Investigate better way to guess the preferred layout | 38 // TODO(nona): Investigate better way to guess the preferred layout |
39 // http://crbug.com/170601. | 39 // http://crbug.com/170601. |
40 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; | 40 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; |
41 } | 41 } |
42 | 42 |
43 std::string InputMethodDescriptor::GetIndicator() const { | 43 std::string InputMethodDescriptor::GetIndicator() const { |
44 // If indicator is empty, use the first two character in its preferred | 44 // If indicator is empty, use the first two character in its preferred |
45 // keyboard layout or language code. | 45 // keyboard layout or language code. |
46 if (indicator_.empty()) { | 46 if (indicator_.empty()) { |
47 if (extension_ime_util::IsKeyboardLayoutExtension(id_)) { | 47 if (extension_ime_util::IsKeyboardLayoutExtension(id_)) { |
48 return base::StringToUpperASCII( | 48 return base::ToUpperASCII(GetPreferredKeyboardLayout().substr(0, 2)); |
49 GetPreferredKeyboardLayout().substr(0, 2)); | |
50 } | 49 } |
51 DCHECK(language_codes_.size() > 0); | 50 DCHECK(language_codes_.size() > 0); |
52 return base::StringToUpperASCII(language_codes_[0].substr(0, 2)); | 51 return base::ToUpperASCII(language_codes_[0].substr(0, 2)); |
53 } | 52 } |
54 return indicator_; | 53 return indicator_; |
55 } | 54 } |
56 | 55 |
57 InputMethodDescriptor::InputMethodDescriptor() { | 56 InputMethodDescriptor::InputMethodDescriptor() { |
58 } | 57 } |
59 | 58 |
60 InputMethodDescriptor::~InputMethodDescriptor() { | 59 InputMethodDescriptor::~InputMethodDescriptor() { |
61 } | 60 } |
62 | 61 |
63 } // namespace input_method | 62 } // namespace input_method |
64 } // namespace chromeos | 63 } // namespace chromeos |
OLD | NEW |