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