Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2364)

Unified Diff: chromeos/ime/input_method_descriptor.cc

Issue 608183002: Move all white-listed input method indicator text from InputMethodUtil to manifests of IME extensio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revised per comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/ime/input_method_descriptor.h ('k') | extensions/common/manifest_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
}
« no previous file with comments | « chromeos/ime/input_method_descriptor.h ('k') | extensions/common/manifest_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698