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_property.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_property.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 namespace input_method { | 12 namespace input_method { |
13 | 13 |
14 InputMethodProperty::InputMethodProperty(const std::string& in_key, | 14 InputMethodProperty::InputMethodProperty(const std::string& in_key, |
15 const std::string& in_label, | 15 const std::string& in_label, |
16 bool in_is_selection_item, | 16 bool in_is_selection_item, |
17 bool in_is_selection_item_checked, | 17 bool in_is_selection_item_checked) |
18 int in_selection_item_id) | |
19 : key(in_key), | 18 : key(in_key), |
20 label(in_label), | 19 label(in_label), |
21 is_selection_item(in_is_selection_item), | 20 is_selection_item(in_is_selection_item), |
22 is_selection_item_checked(in_is_selection_item_checked), | 21 is_selection_item_checked(in_is_selection_item_checked) { |
23 selection_item_id(in_selection_item_id) { | |
24 DCHECK(!key.empty()); | 22 DCHECK(!key.empty()); |
25 } | 23 } |
26 | 24 |
27 InputMethodProperty::InputMethodProperty() | 25 InputMethodProperty::InputMethodProperty() |
28 : is_selection_item(false), | 26 : is_selection_item(false), |
29 is_selection_item_checked(false), | 27 is_selection_item_checked(false) { |
30 selection_item_id(kInvalidSelectionItemId) { | |
31 } | 28 } |
32 | 29 |
33 InputMethodProperty::~InputMethodProperty() { | 30 InputMethodProperty::~InputMethodProperty() { |
34 } | 31 } |
35 | 32 |
36 bool InputMethodProperty::operator==(const InputMethodProperty& other) const { | 33 bool InputMethodProperty::operator==(const InputMethodProperty& other) const { |
37 return key == other.key && | 34 return key == other.key && |
38 label == other.label && | 35 label == other.label && |
39 is_selection_item == other.is_selection_item && | 36 is_selection_item == other.is_selection_item && |
40 is_selection_item_checked == other.is_selection_item_checked && | 37 is_selection_item_checked == other.is_selection_item_checked; |
41 selection_item_id == other.selection_item_id; | |
42 } | 38 } |
43 | 39 |
44 bool InputMethodProperty::operator!=(const InputMethodProperty& other) const { | 40 bool InputMethodProperty::operator!=(const InputMethodProperty& other) const { |
45 return !(*this == other); | 41 return !(*this == other); |
46 } | 42 } |
47 | 43 |
48 std::string InputMethodProperty::ToString() const { | 44 std::string InputMethodProperty::ToString() const { |
49 std::stringstream stream; | 45 std::stringstream stream; |
50 stream << "key=" << key | 46 stream << "key=" << key |
51 << ", label=" << label | 47 << ", label=" << label |
52 << ", is_selection_item=" << is_selection_item | 48 << ", is_selection_item=" << is_selection_item |
53 << ", is_selection_item_checked=" << is_selection_item_checked | 49 << ", is_selection_item_checked=" << is_selection_item_checked; |
54 << ", selection_item_id=" << selection_item_id; | |
55 return stream.str(); | 50 return stream.str(); |
56 } | 51 } |
57 | 52 |
58 } // namespace input_method | 53 } // namespace input_method |
59 } // namespace chromeos | 54 } // namespace chromeos |
OLD | NEW |