diff options
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_html_writer.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_html_writer.cc | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index 9561543..5ec7ca0 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -85,7 +85,7 @@ class Writer : public Task { if (!Write(kHeader) || bookmarks_->GetType() != Value::TYPE_DICTIONARY || !static_cast<DictionaryValue*>(bookmarks_.get())->Get( - WideToUTF16Hack(BookmarkCodec::kRootsKey), &roots) || + BookmarkCodec::kRootsKey, &roots) || roots->GetType() != Value::TYPE_DICTIONARY) { NOTREACHED(); return; @@ -94,12 +94,11 @@ class Writer : public Task { DictionaryValue* roots_d_value = static_cast<DictionaryValue*>(roots); Value* root_folder_value; Value* other_folder_value; - if (!roots_d_value->Get(WideToUTF16Hack(BookmarkCodec::kRootFolderNameKey), + if (!roots_d_value->Get(BookmarkCodec::kRootFolderNameKey, &root_folder_value) || root_folder_value->GetType() != Value::TYPE_DICTIONARY || - !roots_d_value->Get( - WideToUTF16Hack(BookmarkCodec::kOtherBookmarFolderNameKey), - &other_folder_value) || + !roots_d_value->Get(BookmarkCodec::kOtherBookmarFolderNameKey, + &other_folder_value) || other_folder_value->GetType() != Value::TYPE_DICTIONARY) { NOTREACHED(); return; // Invalid type for root folder and/or other folder. @@ -204,32 +203,29 @@ class Writer : public Task { // Writes the node and all its children, returning true on success. bool WriteNode(const DictionaryValue& value, history::StarredEntry::Type folder_type) { - string16 title, date_added_string, type_string; - if (!value.GetString(WideToUTF16Hack(BookmarkCodec::kNameKey), &title) || - !value.GetString(WideToUTF16Hack(BookmarkCodec::kDateAddedKey), - &date_added_string) || - !value.GetString(WideToUTF16Hack(BookmarkCodec::kTypeKey), - &type_string) || - (type_string != WideToUTF16Hack(BookmarkCodec::kTypeURL) && - type_string != WideToUTF16Hack(BookmarkCodec::kTypeFolder))) { + std::wstring title, date_added_string, type_string; + if (!value.GetString(BookmarkCodec::kNameKey, &title) || + !value.GetString(BookmarkCodec::kDateAddedKey, &date_added_string) || + !value.GetString(BookmarkCodec::kTypeKey, &type_string) || + (type_string != BookmarkCodec::kTypeURL && + type_string != BookmarkCodec::kTypeFolder)) { NOTREACHED(); return false; } - if (type_string == WideToUTF16Hack(BookmarkCodec::kTypeURL)) { - string16 url_string; - if (!value.GetString(WideToUTF16Hack(BookmarkCodec::kURLKey), - &url_string)) { + if (type_string == BookmarkCodec::kTypeURL) { + std::wstring url_string; + if (!value.GetString(BookmarkCodec::kURLKey, &url_string)) { NOTREACHED(); return false; } if (!WriteIndent() || !Write(kBookmarkStart) || - !Write(UTF16ToWideHack(url_string), ATTRIBUTE_VALUE) || + !Write(url_string, ATTRIBUTE_VALUE) || !Write(kAddDate) || - !WriteTime(UTF16ToWideHack(date_added_string)) || + !WriteTime(date_added_string) || !Write(kBookmarkAttributeEnd) || - !Write(UTF16ToWideHack(title), CONTENT) || + !Write(title, CONTENT) || !Write(kBookmarkEnd) || !Write(kNewline)) { return false; @@ -238,12 +234,11 @@ class Writer : public Task { } // Folder. - string16 last_modified_date; + std::wstring last_modified_date; Value* child_values; - if (!value.GetString(WideToUTF16Hack(BookmarkCodec::kDateModifiedKey), + if (!value.GetString(BookmarkCodec::kDateModifiedKey, &last_modified_date) || - !value.Get(WideToUTF16Hack(BookmarkCodec::kChildrenKey), - &child_values) || + !value.Get(BookmarkCodec::kChildrenKey, &child_values) || child_values->GetType() != Value::TYPE_LIST) { NOTREACHED(); return false; @@ -254,19 +249,19 @@ class Writer : public Task { // bar folder. if (!WriteIndent() || !Write(kFolderStart) || - !WriteTime(UTF16ToWideHack(date_added_string)) || + !WriteTime(date_added_string) || !Write(kLastModified) || - !WriteTime(UTF16ToWideHack(last_modified_date))) { + !WriteTime(last_modified_date)) { return false; } if (folder_type == history::StarredEntry::BOOKMARK_BAR) { if (!Write(kBookmarkBar)) return false; - title = LIT16("Bookmark Bar"); + title = L"Bookmark Bar"; } else if (!Write(kFolderAttributeEnd)) { return false; } - if (!Write(UTF16ToWideHack(title), CONTENT) || + if (!Write(title, CONTENT) || !Write(kFolderEnd) || !Write(kNewline) || !WriteIndent() || |