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