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 "chromeos/dbus/ibus/ibus_property.h" | 5 #include "chromeos/dbus/ibus/ibus_property.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chromeos/dbus/ibus/ibus_constants.h" | 9 #include "chromeos/dbus/ibus/ibus_constants.h" |
10 #include "chromeos/dbus/ibus/ibus_object.h" | 10 #include "chromeos/dbus/ibus/ibus_object.h" |
11 #include "chromeos/dbus/ibus/ibus_text.h" | 11 #include "chromeos/dbus/ibus/ibus_text.h" |
12 #include "dbus/message.h" | 12 #include "dbus/message.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 // TODO(nona): remove ibus namespace after complete libibus removal. | |
16 namespace ibus { | |
17 | 15 |
18 bool CHROMEOS_EXPORT PopIBusProperty(dbus::MessageReader* reader, | 16 bool CHROMEOS_EXPORT PopIBusProperty(dbus::MessageReader* reader, |
19 IBusProperty* property) { | 17 IBusProperty* property) { |
20 IBusObjectReader ibus_property_reader("IBusProperty", reader); | 18 IBusObjectReader ibus_property_reader("IBusProperty", reader); |
21 if (!ibus_property_reader.Init()) | 19 if (!ibus_property_reader.Init()) |
22 return false; | 20 return false; |
23 | 21 |
24 std::string key; | 22 std::string key; |
25 if (!ibus_property_reader.PopString(&key)) { | 23 if (!ibus_property_reader.PopString(&key)) { |
26 LOG(ERROR) << "Invalid variant structure[IBusProperty]: " | 24 LOG(ERROR) << "Invalid variant structure[IBusProperty]: " |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 << "8th argument should be unsigned 32bit integer."; | 85 << "8th argument should be unsigned 32bit integer."; |
88 return false; | 86 return false; |
89 } | 87 } |
90 | 88 |
91 if (type > 3UL) { | 89 if (type > 3UL) { |
92 LOG(ERROR) << "Invalid value for IBusProperty."; | 90 LOG(ERROR) << "Invalid value for IBusProperty."; |
93 return false; | 91 return false; |
94 } | 92 } |
95 | 93 |
96 DCHECK_LE(state, 3UL); | 94 DCHECK_LE(state, 3UL); |
97 if (state == IBUS_PROPERTY_STATE_INCONSISTENT) { | 95 if (state == ibus::IBUS_PROPERTY_STATE_INCONSISTENT) { |
98 LOG(ERROR) << "PROP_STATE_INCONSISTENT is not supported in Chrome OS."; | 96 LOG(ERROR) << "PROP_STATE_INCONSISTENT is not supported in Chrome OS."; |
99 } else { | 97 } else { |
100 property->set_checked(state == IBUS_PROPERTY_STATE_CHECKED); | 98 property->set_checked(state == ibus::IBUS_PROPERTY_STATE_CHECKED); |
101 } | 99 } |
102 | 100 |
103 if (!ibus_property_reader.PopIBusPropertyList( | 101 if (!ibus_property_reader.PopIBusPropertyList( |
104 property->mutable_sub_properties())) { | 102 property->mutable_sub_properties())) { |
105 LOG(ERROR) << "Invalid variant structure[IBusProperty]: " | 103 LOG(ERROR) << "Invalid variant structure[IBusProperty]: " |
106 << "9th argument should be IBusPropList."; | 104 << "9th argument should be IBusPropList."; |
107 return false; | 105 return false; |
108 } | 106 } |
109 | 107 |
110 return true; | 108 return true; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // IBusProperty | 171 // IBusProperty |
174 IBusProperty::IBusProperty() | 172 IBusProperty::IBusProperty() |
175 : type_(IBUS_PROPERTY_TYPE_NORMAL), | 173 : type_(IBUS_PROPERTY_TYPE_NORMAL), |
176 visible_(false), | 174 visible_(false), |
177 checked_(false) { | 175 checked_(false) { |
178 } | 176 } |
179 | 177 |
180 IBusProperty::~IBusProperty() { | 178 IBusProperty::~IBusProperty() { |
181 } | 179 } |
182 | 180 |
183 } // namespace ibus | |
184 } // namespace chromeos | 181 } // namespace chromeos |
OLD | NEW |