#include "components/bookmarks/browser/bookmark_codec.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <string_view>
#include <utility>
#include "base/base64.h"
#include "base/containers/contains.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "base/values.h"
#include "components/bookmarks/browser/bookmark_uuids.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
Time;
namespace bookmarks {
const char BookmarkCodec::kRootsKey[] = …;
const char BookmarkCodec::kBookmarkBarFolderNameKey[] = …;
const char BookmarkCodec::kOtherBookmarkFolderNameKey[] = …;
const char BookmarkCodec::kMobileBookmarkFolderNameKey[] = …;
const char BookmarkCodec::kVersionKey[] = …;
const char BookmarkCodec::kChecksumKey[] = …;
const char BookmarkCodec::kIdKey[] = …;
const char BookmarkCodec::kTypeKey[] = …;
const char BookmarkCodec::kNameKey[] = …;
const char BookmarkCodec::kGuidKey[] = …;
const char BookmarkCodec::kDateAddedKey[] = …;
const char BookmarkCodec::kURLKey[] = …;
const char BookmarkCodec::kDateModifiedKey[] = …;
const char BookmarkCodec::kChildrenKey[] = …;
const char BookmarkCodec::kMetaInfo[] = …;
const char BookmarkCodec::kTypeURL[] = …;
const char BookmarkCodec::kTypeFolder[] = …;
const char BookmarkCodec::kSyncMetadata[] = …;
const char BookmarkCodec::kDateLastUsed[] = …;
static const int kCurrentVersion = …;
namespace {
base::Value EncodeSyncMetadata(std::string sync_metadata_str) { … }
}
BookmarkCodec::BookmarkCodec() = default;
BookmarkCodec::~BookmarkCodec() = default;
base::Value::Dict BookmarkCodec::Encode(
const BookmarkNode* bookmark_bar_node,
const BookmarkNode* other_folder_node,
const BookmarkNode* mobile_folder_node,
std::string sync_metadata_str) { … }
bool BookmarkCodec::Decode(const base::Value::Dict& value,
std::set<int64_t> already_assigned_ids,
BookmarkNode* bb_node,
BookmarkNode* other_folder_node,
BookmarkNode* mobile_folder_node,
int64_t* max_id,
std::string* sync_metadata_str) { … }
bool BookmarkCodec::required_recovery() const { … }
base::Value::Dict BookmarkCodec::EncodeNode(const BookmarkNode* node) { … }
base::Value::Dict BookmarkCodec::EncodeMetaInfo(
const BookmarkNode::MetaInfoMap& meta_info_map) { … }
bool BookmarkCodec::DecodeHelper(BookmarkNode* bb_node,
BookmarkNode* other_folder_node,
BookmarkNode* mobile_folder_node,
const base::Value::Dict& value,
std::string* sync_metadata_str) { … }
bool BookmarkCodec::DecodeChildren(const base::Value::List& child_value_list,
BookmarkNode* parent) { … }
bool BookmarkCodec::DecodeNode(const base::Value::Dict& value,
BookmarkNode* parent,
BookmarkNode* node) { … }
bool BookmarkCodec::DecodeMetaInfo(const base::Value::Dict& value,
BookmarkNode::MetaInfoMap* meta_info_map) { … }
void BookmarkCodec::DecodeMetaInfoHelper(
const base::Value::Dict& dict,
const std::string& prefix,
BookmarkNode::MetaInfoMap* meta_info_map) { … }
void BookmarkCodec::ReassignIDs(BookmarkNode* bb_node,
BookmarkNode* other_node,
BookmarkNode* mobile_node) { … }
void BookmarkCodec::ReassignIDsHelper(BookmarkNode* node) { … }
void BookmarkCodec::UpdateChecksum(const std::string& str) { … }
void BookmarkCodec::UpdateChecksum(const std::u16string& str) { … }
void BookmarkCodec::UpdateChecksumWithUrlNode(const std::string& id,
const std::u16string& title,
const std::string& url) { … }
void BookmarkCodec::UpdateChecksumWithFolderNode(const std::string& id,
const std::u16string& title) { … }
void BookmarkCodec::InitializeChecksum() { … }
void BookmarkCodec::FinalizeChecksum() { … }
}