summaryrefslogtreecommitdiffstats
path: root/chromeos/ime/input_method_descriptor.cc
diff options
context:
space:
mode:
authornona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-24 06:56:51 +0000
committernona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-24 06:56:51 +0000
commit241508e9a25e0ba119c9b8b52730b5f48ba0819e (patch)
tree48ff1bad428af5c5a9c24d9b22c497fe0a67f5ef /chromeos/ime/input_method_descriptor.cc
parent69fbed1756fd299dcf23f72be39d6de4424a3268 (diff)
downloadchromium_src-241508e9a25e0ba119c9b8b52730b5f48ba0819e.zip
chromium_src-241508e9a25e0ba119c9b8b52730b5f48ba0819e.tar.gz
chromium_src-241508e9a25e0ba119c9b8b52730b5f48ba0819e.tar.bz2
Move InputMethodDescriptor from c/b/chromeos to chromeos/ime
This is part of extraction work for input method from chrome/browser/chromeos. BUG=164375 TEST=None TBR=sky Review URL: https://chromiumcodereview.appspot.com/12902005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/ime/input_method_descriptor.cc')
-rw-r--r--chromeos/ime/input_method_descriptor.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/chromeos/ime/input_method_descriptor.cc b/chromeos/ime/input_method_descriptor.cc
new file mode 100644
index 0000000..4ded598
--- /dev/null
+++ b/chromeos/ime/input_method_descriptor.cc
@@ -0,0 +1,68 @@
+// 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"
+
+namespace chromeos {
+namespace input_method {
+
+namespace {
+const char kFallbackLayout[] = "us";
+} // namespace
+
+InputMethodDescriptor::InputMethodDescriptor(const std::string& id,
+ const std::string& name,
+ const std::string& keyboard_layout,
+ const std::string& language_code,
+ bool third_party)
+ : id_(id),
+ name_(name),
+ keyboard_layout_(keyboard_layout),
+ language_code_(language_code),
+ third_party_(third_party) {
+}
+
+InputMethodDescriptor::InputMethodDescriptor() : third_party_(false) {
+}
+
+InputMethodDescriptor::~InputMethodDescriptor() {
+}
+
+bool InputMethodDescriptor::operator==(
+ const InputMethodDescriptor& other) const {
+ return id() == other.id();
+}
+
+bool InputMethodDescriptor::operator!=(
+ const InputMethodDescriptor& other) const {
+ return !(*this == other);
+}
+
+// static
+InputMethodDescriptor
+InputMethodDescriptor::GetFallbackInputMethodDescriptor() {
+ return InputMethodDescriptor("xkb:us::eng",
+ "",
+ kFallbackLayout,
+ "en-US",
+ false);
+}
+
+std::string InputMethodDescriptor::ToString() const {
+ std::stringstream stream;
+ stream << "id=" << id()
+ << ", name=" << name()
+ << ", keyboard_layout=" << keyboard_layout()
+ << ", language_code=" << language_code()
+ << ", third_party=" << third_party();
+ return stream.str();
+}
+
+} // namespace input_method
+} // namespace chromeos