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
3 // found in the LICENSE file.
4
5 #include "chromeos/ime/input_method_descriptor.h"
6
7 #include <sstream>
8
9 #include "base/logging.h"
10 #include "base/strings/string_split.h"
11 #include "url/gurl.h"
12
13 namespace chromeos {
14 namespace input_method {
15
InputMethodDescriptor(const std::string & id,const std::string & name,const std::vector<std::string> & keyboard_layouts,const std::vector<std::string> & language_codes,bool is_login_keyboard,const GURL & options_page_url,const GURL & input_view_url)16 InputMethodDescriptor::InputMethodDescriptor(
17 const std::string& id,
18 const std::string& name,
19 const std::vector<std::string>& keyboard_layouts,
20 const std::vector<std::string>& language_codes,
21 bool is_login_keyboard,
22 const GURL& options_page_url,
23 const GURL& input_view_url)
24 : id_(id),
25 name_(name),
26 keyboard_layouts_(keyboard_layouts),
27 language_codes_(language_codes),
28 is_login_keyboard_(is_login_keyboard),
29 options_page_url_(options_page_url),
30 input_view_url_(input_view_url) {
31 }
32
GetPreferredKeyboardLayout() const33 std::string InputMethodDescriptor::GetPreferredKeyboardLayout() const {
34 // TODO(nona): Investigate better way to guess the preferred layout
35 // http://crbug.com/170601.
36 return keyboard_layouts_.empty() ? "us" : keyboard_layouts_[0];
37 }
38
InputMethodDescriptor()39 InputMethodDescriptor::InputMethodDescriptor() {
40 }
41
~InputMethodDescriptor()42 InputMethodDescriptor::~InputMethodDescriptor() {
43 }
44
45 } // namespace input_method
46 } // namespace chromeos
47