| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h" | |
| 6 | |
| 7 #include <sstream> | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #include "base/strings/string_split.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 namespace input_method { | |
| 14 | |
| 15 namespace { | |
| 16 const char kFallbackLayout[] = "us"; | |
| 17 } // namespace | |
| 18 | |
| 19 InputMethodDescriptor::InputMethodDescriptor(const std::string& id, | |
| 20 const std::string& name, | |
| 21 const std::string& keyboard_layout, | |
| 22 const std::string& language_code, | |
| 23 bool third_party) | |
| 24 : id_(id), | |
| 25 name_(name), | |
| 26 keyboard_layout_(keyboard_layout), | |
| 27 language_code_(language_code), | |
| 28 third_party_(third_party) { | |
| 29 } | |
| 30 | |
| 31 InputMethodDescriptor::InputMethodDescriptor() : third_party_(false) { | |
| 32 } | |
| 33 | |
| 34 InputMethodDescriptor::~InputMethodDescriptor() { | |
| 35 } | |
| 36 | |
| 37 bool InputMethodDescriptor::operator==( | |
| 38 const InputMethodDescriptor& other) const { | |
| 39 return id() == other.id(); | |
| 40 } | |
| 41 | |
| 42 bool InputMethodDescriptor::operator!=( | |
| 43 const InputMethodDescriptor& other) const { | |
| 44 return !(*this == other); | |
| 45 } | |
| 46 | |
| 47 // static | |
| 48 InputMethodDescriptor | |
| 49 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { | |
| 50 return InputMethodDescriptor("xkb:us::eng", | |
| 51 "", | |
| 52 kFallbackLayout, | |
| 53 "en-US", | |
| 54 false); | |
| 55 } | |
| 56 | |
| 57 std::string InputMethodDescriptor::ToString() const { | |
| 58 std::stringstream stream; | |
| 59 stream << "id=" << id() | |
| 60 << ", name=" << name() | |
| 61 << ", keyboard_layout=" << keyboard_layout() | |
| 62 << ", language_code=" << language_code() | |
| 63 << ", third_party=" << third_party(); | |
| 64 return stream.str(); | |
| 65 } | |
| 66 | |
| 67 } // namespace input_method | |
| 68 } // namespace chromeos | |
| OLD | NEW |