| 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 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 namespace input_method { | 14 namespace input_method { |
| 15 | 15 |
| 16 InputMethodDescriptor::InputMethodDescriptor( | 16 InputMethodDescriptor::InputMethodDescriptor( |
| 17 const std::string& id, | 17 const std::string& id, |
| 18 const std::string& name, | 18 const std::string& name, |
| 19 const std::vector<std::string>& keyboard_layouts, | 19 const std::vector<std::string>& keyboard_layouts, |
| 20 const std::vector<std::string>& language_codes, | 20 const std::vector<std::string>& language_codes, |
| 21 bool is_login_keyboard, |
| 21 const GURL& options_page_url) | 22 const GURL& options_page_url) |
| 22 : id_(id), | 23 : id_(id), |
| 23 name_(name), | 24 name_(name), |
| 24 keyboard_layouts_(keyboard_layouts), | 25 keyboard_layouts_(keyboard_layouts), |
| 25 language_codes_(language_codes), | 26 language_codes_(language_codes), |
| 27 is_login_keyboard_(is_login_keyboard), |
| 26 options_page_url_(options_page_url) { | 28 options_page_url_(options_page_url) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const { | 31 std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const { |
| 30 // TODO(nona): Investigate better way to guess the preferred layout | 32 // TODO(nona): Investigate better way to guess the preferred layout |
| 31 // http://crbug.com/170601. | 33 // http://crbug.com/170601. |
| 32 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; | 34 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0]; |
| 33 } | 35 } |
| 34 | 36 |
| 35 InputMethodDescriptor::InputMethodDescriptor() { | 37 InputMethodDescriptor::InputMethodDescriptor() { |
| 36 } | 38 } |
| 37 | 39 |
| 38 InputMethodDescriptor::~InputMethodDescriptor() { | 40 InputMethodDescriptor::~InputMethodDescriptor() { |
| 39 } | 41 } |
| 40 | 42 |
| 41 } // namespace input_method | 43 } // namespace input_method |
| 42 } // namespace chromeos | 44 } // namespace chromeos |
| OLD | NEW |