diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-19 17:16:44 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-19 17:16:44 +0000 |
commit | a9229588ea2981ab8e2532e6a8f8dfcc969625e2 (patch) | |
tree | c468022bb0aa030a0148d1f6e8e423b678a6aeec /chromeos | |
parent | 511fcb9c0469251ca99c7f7b5d8b22bc9208133a (diff) | |
download | chromium_src-a9229588ea2981ab8e2532e6a8f8dfcc969625e2.zip chromium_src-a9229588ea2981ab8e2532e6a8f8dfcc969625e2.tar.gz chromium_src-a9229588ea2981ab8e2532e6a8f8dfcc969625e2.tar.bz2 |
Fix: infolist requries description title.
Sorry I misunderstand the infolist spec, infolist requires title field.
I split description field into description_title and description_body.
BUG=129403
TEST=ran chromeos_unittests
Review URL: https://chromiumcodereview.appspot.com/11362111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/ibus/ibus_lookup_table.cc | 3 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_lookup_table.h | 3 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_text.cc | 39 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_text.h | 14 | ||||
-rw-r--r-- | chromeos/dbus/ibus/ibus_text_unittest.cc | 9 |
5 files changed, 47 insertions, 21 deletions
diff --git a/chromeos/dbus/ibus/ibus_lookup_table.cc b/chromeos/dbus/ibus/ibus_lookup_table.cc index 9a751b3..e01ab74 100644 --- a/chromeos/dbus/ibus/ibus_lookup_table.cc +++ b/chromeos/dbus/ibus/ibus_lookup_table.cc @@ -137,7 +137,8 @@ bool PopIBusLookupTable(dbus::MessageReader* reader, IBusLookupTable* table) { IBusLookupTable::Entry entry; entry.value = candidate_text.text(); entry.annotation = candidate_text.annotation(); - entry.description = candidate_text.description(); + entry.description_title = candidate_text.description_title(); + entry.description_body = candidate_text.description_body(); candidates->push_back(entry); } diff --git a/chromeos/dbus/ibus/ibus_lookup_table.h b/chromeos/dbus/ibus/ibus_lookup_table.h index 0e1fe0f..d87bf55 100644 --- a/chromeos/dbus/ibus/ibus_lookup_table.h +++ b/chromeos/dbus/ibus/ibus_lookup_table.h @@ -95,7 +95,8 @@ class CHROMEOS_EXPORT IBusLookupTable { std::string value; std::string label; std::string annotation; - std::string description; + std::string description_title; + std::string description_body; }; IBusLookupTable(); diff --git a/chromeos/dbus/ibus/ibus_text.cc b/chromeos/dbus/ibus/ibus_text.cc index ea290cc..a60ffe5 100644 --- a/chromeos/dbus/ibus/ibus_text.cc +++ b/chromeos/dbus/ibus/ibus_text.cc @@ -17,7 +17,8 @@ namespace { const uint32 kAttributeUnderline = 1; // Indicates underline attribute. const uint32 kAttributeSelection = 2; // Indicates background attribute. const char kAnnotationKey[] = "annotation"; -const char kDescriptionKey[] = "description"; +const char kDescriptionTitleKey[] = "description_title"; +const char kDescriptionBodyKey[] = "description_body"; struct IBusAttribute { IBusAttribute() : type(0), value(0), start_index(0), end_index(0) {} @@ -67,11 +68,17 @@ void AppendIBusText(const IBusText& ibus_text, dbus::MessageWriter* writer) { base::Value::CreateStringValue(ibus_text.annotation())); ibus_text_writer.AddAttachment(kAnnotationKey, *annotation.get()); } - - if (!ibus_text.description().empty()) { - scoped_ptr<base::Value> description( - base::Value::CreateStringValue(ibus_text.description())); - ibus_text_writer.AddAttachment(kDescriptionKey, *description.get()); + if (!ibus_text.description_title().empty()) { + scoped_ptr<base::Value> description_title( + base::Value::CreateStringValue(ibus_text.description_title())); + ibus_text_writer.AddAttachment(kDescriptionTitleKey, + *description_title.get()); + } + if (!ibus_text.description_body().empty()) { + scoped_ptr<base::Value> description_body( + base::Value::CreateStringValue(ibus_text.description_body())); + ibus_text_writer.AddAttachment(kDescriptionBodyKey, + *description_body.get()); } ibus_text_writer.CloseHeader(); @@ -133,12 +140,20 @@ bool PopIBusText(dbus::MessageReader* reader, IBusText* ibus_text) { ibus_text->set_annotation(annotation); } - const base::Value* description_value = - ibus_text_reader.GetAttachment(kDescriptionKey); - if (description_value) { - std::string description; - if (description_value->GetAsString(&description)) - ibus_text->set_description(description); + const base::Value* description_title_value = + ibus_text_reader.GetAttachment(kDescriptionTitleKey); + if (description_title_value) { + std::string description_title; + if (description_title_value->GetAsString(&description_title)) + ibus_text->set_description_title(description_title); + } + + const base::Value* description_body_value = + ibus_text_reader.GetAttachment(kDescriptionBodyKey); + if (description_body_value) { + std::string description_body; + if (description_body_value->GetAsString(&description_body)) + ibus_text->set_description_body(description_body); } std::string text; diff --git a/chromeos/dbus/ibus/ibus_text.h b/chromeos/dbus/ibus/ibus_text.h index 13b3bd1..57af587 100644 --- a/chromeos/dbus/ibus/ibus_text.h +++ b/chromeos/dbus/ibus/ibus_text.h @@ -149,9 +149,14 @@ class CHROMEOS_EXPORT IBusText { annotation_ = annotation; } - const std::string& description() const { return description_; } - void set_description(const std::string& description) { - description_ = description; + const std::string& description_title() const { return description_title_; } + void set_description_title(const std::string& title) { + description_title_ = title; + } + + const std::string& description_body() const { return description_body_; } + void set_description_body(const std::string& body) { + description_body_ = body; } const std::vector<UnderlineAttribute>& underline_attributes() const { @@ -172,7 +177,8 @@ class CHROMEOS_EXPORT IBusText { private: std::string text_; std::string annotation_; - std::string description_; + std::string description_title_; + std::string description_body_; std::vector<UnderlineAttribute> underline_attributes_; std::vector<SelectionAttribute> selection_attributes_; diff --git a/chromeos/dbus/ibus/ibus_text_unittest.cc b/chromeos/dbus/ibus/ibus_text_unittest.cc index d87bf39..b829123 100644 --- a/chromeos/dbus/ibus/ibus_text_unittest.cc +++ b/chromeos/dbus/ibus/ibus_text_unittest.cc @@ -22,7 +22,8 @@ namespace ibus { TEST(IBusTextTest, WriteReadTest) { const char kSampleText[] = "Sample Text"; const char kAnnotation[] = "Annotation"; - const char kDescription[] = "Description"; + const char kDescriptionTitle[] = "Description Title"; + const char kDescriptionBody[] = "Description Body"; const IBusText::UnderlineAttribute kSampleUnderlineAttribute1 = { IBusText::IBUS_TEXT_UNDERLINE_SINGLE, 10, 20}; @@ -38,7 +39,8 @@ TEST(IBusTextTest, WriteReadTest) { IBusText text; text.set_text(kSampleText); text.set_annotation(kAnnotation); - text.set_description(kDescription); + text.set_description_title(kDescriptionTitle); + text.set_description_body(kDescriptionBody); std::vector<IBusText::UnderlineAttribute>* underline_attributes = text.mutable_underline_attributes(); underline_attributes->push_back(kSampleUnderlineAttribute1); @@ -59,7 +61,8 @@ TEST(IBusTextTest, WriteReadTest) { ASSERT_TRUE(PopIBusText(&reader, &expected_text)); EXPECT_EQ(kSampleText, expected_text.text()); EXPECT_EQ(kAnnotation, expected_text.annotation()); - EXPECT_EQ(kDescription, expected_text.description()); + EXPECT_EQ(kDescriptionTitle, expected_text.description_title()); + EXPECT_EQ(kDescriptionBody, expected_text.description_body()); EXPECT_EQ(3U, expected_text.underline_attributes().size()); EXPECT_EQ(1U, expected_text.selection_attributes().size()); } |