OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/input_method_descriptor.h" | 5 #include "chrome/browser/chromeos/input_method/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/string_split.h" | 10 #include "base/string_split.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 namespace input_method { | 13 namespace input_method { |
14 | 14 |
15 namespace { | 15 namespace { |
16 const char kFallbackLayout[] = "us"; | 16 const char kFallbackLayout[] = "us"; |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 InputMethodDescriptor::InputMethodDescriptor(const std::string& id, | 19 InputMethodDescriptor::InputMethodDescriptor(const std::string& id, |
20 const std::string& name, | 20 const std::string& name, |
21 const std::string& keyboard_layout, | 21 const std::string& keyboard_layout, |
22 const std::string& language_code) | 22 const std::string& language_code, |
| 23 bool third_party) |
23 : id_(id), | 24 : id_(id), |
24 name_(name), | 25 name_(name), |
25 keyboard_layout_(keyboard_layout), | 26 keyboard_layout_(keyboard_layout), |
26 language_code_(language_code) { | 27 language_code_(language_code), |
| 28 third_party_(third_party) { |
27 } | 29 } |
28 | 30 |
29 InputMethodDescriptor::InputMethodDescriptor() { | 31 InputMethodDescriptor::InputMethodDescriptor() : third_party_(false) { |
30 } | 32 } |
31 | 33 |
32 InputMethodDescriptor::~InputMethodDescriptor() { | 34 InputMethodDescriptor::~InputMethodDescriptor() { |
33 } | 35 } |
34 | 36 |
35 bool InputMethodDescriptor::operator==( | 37 bool InputMethodDescriptor::operator==( |
36 const InputMethodDescriptor& other) const { | 38 const InputMethodDescriptor& other) const { |
37 return id() == other.id(); | 39 return id() == other.id(); |
38 } | 40 } |
39 | 41 |
40 bool InputMethodDescriptor::operator!=( | 42 bool InputMethodDescriptor::operator!=( |
41 const InputMethodDescriptor& other) const { | 43 const InputMethodDescriptor& other) const { |
42 return !(*this == other); | 44 return !(*this == other); |
43 } | 45 } |
44 | 46 |
45 // static | 47 // static |
46 InputMethodDescriptor | 48 InputMethodDescriptor |
47 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { | 49 InputMethodDescriptor::GetFallbackInputMethodDescriptor() { |
48 return InputMethodDescriptor("xkb:us::eng", | 50 return InputMethodDescriptor("xkb:us::eng", |
49 "", | 51 "", |
50 kFallbackLayout, | 52 kFallbackLayout, |
51 "en-US"); | 53 "en-US", |
| 54 false); |
52 } | 55 } |
53 | 56 |
54 std::string InputMethodDescriptor::ToString() const { | 57 std::string InputMethodDescriptor::ToString() const { |
55 std::stringstream stream; | 58 std::stringstream stream; |
56 stream << "id=" << id() | 59 stream << "id=" << id() |
57 << ", name=" << name() | 60 << ", name=" << name() |
58 << ", keyboard_layout=" << keyboard_layout() | 61 << ", keyboard_layout=" << keyboard_layout() |
59 << ", language_code=" << language_code(); | 62 << ", language_code=" << language_code() |
| 63 << ", third_party=" << third_party(); |
60 return stream.str(); | 64 return stream.str(); |
61 } | 65 } |
62 | 66 |
63 } // namespace input_method | 67 } // namespace input_method |
64 } // namespace chromeos | 68 } // namespace chromeos |
OLD | NEW |