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 InputMethodDescriptor::InputMethodDescriptor( | 15 InputMethodDescriptor::InputMethodDescriptor( |
16 const std::string& id, | 16 const std::string& id, |
17 const std::string& name, | 17 const std::string& name, |
18 const std::string& keyboard_layout, | 18 const std::vector<std::string>& keyboard_layouts, |
19 const std::string& language_code, | 19 const std::string& language_code, |
20 const std::string& options_page_url) | 20 const std::string& options_page_url) |
21 : id_(id), | 21 : id_(id), |
22 name_(name), | 22 name_(name), |
23 keyboard_layout_(keyboard_layout), | 23 keyboard_layouts_(keyboard_layouts), |
24 language_code_(language_code), | 24 language_code_(language_code), |
25 options_page_url_(options_page_url) { | 25 options_page_url_(options_page_url) { |
26 } | 26 } |
27 | 27 |
| 28 std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const { |
| 29 // TODO(nona): Investigate better way to guess the preferred layout |
| 30 // http://crbug.com/170601. |
| 31 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; |
| 32 } |
| 33 |
28 InputMethodDescriptor::InputMethodDescriptor() { | 34 InputMethodDescriptor::InputMethodDescriptor() { |
29 } | 35 } |
30 | 36 |
31 InputMethodDescriptor::~InputMethodDescriptor() { | 37 InputMethodDescriptor::~InputMethodDescriptor() { |
32 } | 38 } |
33 | 39 |
34 } // namespace input_method | 40 } // namespace input_method |
35 } // namespace chromeos | 41 } // namespace chromeos |
OLD | NEW |