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

Unified Diff: chromeos/ime/input_method_descriptor.cc

Issue 750353004: Revert of Moves code from chromeos/ime to ui/base/ime/chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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') | chromeos/ime/input_method_manager.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
new file mode 100644
index 0000000000000000000000000000000000000000..6b9f42b0a51174d586b25999f8674728c88ae403
--- /dev/null
+++ b/chromeos/ime/input_method_descriptor.cc
@@ -0,0 +1,62 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/ime/input_method_descriptor.h"
+
+#include <sstream>
+
+#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 {
+namespace input_method {
+
+InputMethodDescriptor::InputMethodDescriptor(
+ const std::string& id,
+ const std::string& name,
+ const std::string& indicator,
+ const std::vector<std::string>& keyboard_layouts,
+ const std::vector<std::string>& language_codes,
+ bool is_login_keyboard,
+ const GURL& options_page_url,
+ const GURL& input_view_url)
+ : id_(id),
+ name_(name),
+ keyboard_layouts_(keyboard_layouts),
+ language_codes_(language_codes),
+ indicator_(indicator),
+ is_login_keyboard_(is_login_keyboard),
+ options_page_url_(options_page_url),
+ input_view_url_(input_view_url) {
+}
+
+std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const {
+ // TODO(nona): Investigate better way to guess the preferred layout
+ // http://crbug.com/170601.
+ 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_;
+}
+
+InputMethodDescriptor::InputMethodDescriptor() {
+}
+
+InputMethodDescriptor::~InputMethodDescriptor() {
+}
+
+} // namespace input_method
+} // namespace chromeos
« no previous file with comments | « chromeos/ime/input_method_descriptor.h ('k') | chromeos/ime/input_method_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698