| 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( |
| 20 const std::string& name, | 20 const std::string& id, |
| 21 const std::string& keyboard_layout, | 21 const std::string& name, |
| 22 const std::string& language_code, | 22 const std::string& keyboard_layout, |
| 23 bool third_party) | 23 const std::string& language_code, |
| 24 const std::string& options_page_url, |
| 25 bool third_party) |
| 24 : id_(id), | 26 : id_(id), |
| 25 name_(name), | 27 name_(name), |
| 26 keyboard_layout_(keyboard_layout), | 28 keyboard_layout_(keyboard_layout), |
| 27 language_code_(language_code), | 29 language_code_(language_code), |
| 30 options_page_url_(options_page_url), |
| 28 third_party_(third_party) { | 31 third_party_(third_party) { |
| 29 } | 32 } |
| 30 | 33 |
| 31 InputMethodDescriptor::InputMethodDescriptor() : third_party_(false) { | 34 InputMethodDescriptor::InputMethodDescriptor() : third_party_(false) { |
| 32 } | 35 } |
| 33 | 36 |
| 34 InputMethodDescriptor::~InputMethodDescriptor() { | 37 InputMethodDescriptor::~InputMethodDescriptor() { |
| 35 } | 38 } |
| 36 | 39 |
| 37 bool InputMethodDescriptor::operator==( | 40 bool InputMethodDescriptor::operator==( |
| 38 const InputMethodDescriptor& other) const { | 41 const InputMethodDescriptor& other) const { |
| 39 return id() == other.id(); | 42 return id() == other.id(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 bool InputMethodDescriptor::operator!=( | 45 bool InputMethodDescriptor::operator!=( |
| 43 const InputMethodDescriptor& other) const { | 46 const InputMethodDescriptor& other) const { |
| 44 return !(*this == other); | 47 return !(*this == other); |
| 45 } | 48 } |
| 46 | 49 |
| 47 // static | 50 // static |
| 48 InputMethodDescriptor | 51 InputMethodDescriptor |
| 49 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { | 52 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { |
| 50 return InputMethodDescriptor("xkb:us::eng", | 53 return InputMethodDescriptor("xkb:us::eng", |
| 51 "", | 54 "", |
| 52 kFallbackLayout, | 55 kFallbackLayout, |
| 53 "en-US", | 56 "en-US", |
| 57 "", // options page, not available. |
| 54 false); | 58 false); |
| 55 } | 59 } |
| 56 | 60 |
| 57 std::string InputMethodDescriptor::ToString() const { | 61 std::string InputMethodDescriptor::ToString() const { |
| 58 std::stringstream stream; | 62 std::stringstream stream; |
| 59 stream << "id=" << id() | 63 stream << "id=" << id() |
| 60 << ", name=" << name() | 64 << ", name=" << name() |
| 61 << ", keyboard_layout=" << keyboard_layout() | 65 << ", keyboard_layout=" << keyboard_layout() |
| 62 << ", language_code=" << language_code() | 66 << ", language_code=" << language_code() |
| 67 << ", options_page_url=" << options_page_url() |
| 63 << ", third_party=" << third_party(); | 68 << ", third_party=" << third_party(); |
| 64 return stream.str(); | 69 return stream.str(); |
| 65 } | 70 } |
| 66 | 71 |
| 67 } // namespace input_method | 72 } // namespace input_method |
| 68 } // namespace chromeos | 73 } // namespace chromeos |
| OLD | NEW |