OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/input_method/ibus_controller.h" | 5 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
6 | 6 |
7 #if defined(HAVE_IBUS) | 7 #if defined(HAVE_IBUS) |
8 #include <ibus.h> | 8 #include <ibus.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 InputMethodDescriptor::InputMethodDescriptor() { | 98 InputMethodDescriptor::InputMethodDescriptor() { |
99 } | 99 } |
100 | 100 |
101 InputMethodDescriptor::~InputMethodDescriptor() { | 101 InputMethodDescriptor::~InputMethodDescriptor() { |
102 } | 102 } |
103 | 103 |
| 104 InputMethodDescriptor::InputMethodDescriptor( |
| 105 const std::string& in_id, |
| 106 const std::string& in_keyboard_layout, |
| 107 const std::string& in_virtual_keyboard_layouts, |
| 108 const std::string& in_language_code) |
| 109 : id_(in_id), |
| 110 keyboard_layout_(in_keyboard_layout), |
| 111 language_code_(in_language_code) { |
| 112 DCHECK(keyboard_layout_.find(",") == std::string::npos); |
| 113 base::SplitString( |
| 114 in_virtual_keyboard_layouts, ',', &virtual_keyboard_layouts_); |
| 115 } |
| 116 |
104 // static | 117 // static |
105 InputMethodDescriptor | 118 InputMethodDescriptor |
106 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { | 119 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { |
107 InputMethodDescriptor desc; | 120 return InputMethodDescriptor( |
108 desc.id_ = "xkb:us::eng"; | 121 "xkb:us::eng", kFallbackLayout, kFallbackLayout, "eng"); |
109 desc.keyboard_layout_ = kFallbackLayout; | |
110 desc.virtual_keyboard_layouts_.push_back(kFallbackLayout); | |
111 desc.language_code_ = "eng"; | |
112 return desc; | |
113 } | 122 } |
114 | 123 |
115 std::string InputMethodDescriptor::ToString() const { | 124 std::string InputMethodDescriptor::ToString() const { |
116 std::stringstream stream; | 125 std::stringstream stream; |
117 stream << "id=" << id() | 126 stream << "id=" << id() |
118 << ", keyboard_layout=" << keyboard_layout() | 127 << ", keyboard_layout=" << keyboard_layout() |
119 << ", virtual_keyboard_layouts=" << virtual_keyboard_layouts_.size() | 128 << ", virtual_keyboard_layouts=" << virtual_keyboard_layouts_.size() |
120 << ", language_code=" << language_code(); | 129 << ", language_code=" << language_code(); |
121 return stream.str(); | 130 return stream.str(); |
122 } | 131 } |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 #else | 1341 #else |
1333 return new IBusControllerStubImpl; | 1342 return new IBusControllerStubImpl; |
1334 #endif | 1343 #endif |
1335 } | 1344 } |
1336 | 1345 |
1337 IBusController::~IBusController() { | 1346 IBusController::~IBusController() { |
1338 } | 1347 } |
1339 | 1348 |
1340 } // namespace input_method | 1349 } // namespace input_method |
1341 } // namespace chromeos | 1350 } // namespace chromeos |
OLD | NEW |