Index: chromeos/ime/input_method_descriptor.cc |
diff --git a/chromeos/ime/input_method_descriptor.cc b/chromeos/ime/input_method_descriptor.cc |
index 49b03605eb71b839e577848ada49bd64dd862712..6b9f42b0a51174d586b25999f8674728c88ae403 100644 |
--- a/chromeos/ime/input_method_descriptor.cc |
+++ b/chromeos/ime/input_method_descriptor.cc |
@@ -8,6 +8,8 @@ |
#include "base/logging.h" |
#include "base/strings/string_split.h" |
+#include "base/strings/string_util.h" |
+#include "chromeos/ime/extension_ime_util.h" |
#include "url/gurl.h" |
namespace chromeos { |
@@ -38,6 +40,18 @@ std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const { |
return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; |
} |
+std::string InputMethodDescriptor::GetIndicator() const { |
+ // If indicator is empty, use the first two character in its preferred |
+ // keyboard layout or language code. |
+ if (indicator_.empty()) { |
+ if (extension_ime_util::IsKeyboardLayoutExtension(id_)) |
+ return StringToUpperASCII(GetPreferredKeyboardLayout().substr(0, 2)); |
+ DCHECK(language_codes_.size() > 0); |
+ return StringToUpperASCII(language_codes_[0].substr(0, 2)); |
+ } |
+ return indicator_; |
Seigo Nonaka
2014/09/30 02:49:01
This |indicator_| can be set by third party, right
Shu Chen
2014/09/30 02:52:56
This cl only enables the indicator for component I
|
+} |
+ |
InputMethodDescriptor::InputMethodDescriptor() { |
} |