#include "components/sync_bookmarks/bookmark_model_observer_impl.h"
#include <utility>
#include "base/check.h"
#include "base/no_destructor.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/sync/base/hash_util.h"
#include "components/sync/base/unique_position.h"
#include "components/sync/engine/commit_and_get_updates_types.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync_bookmarks/bookmark_model_view.h"
#include "components/sync_bookmarks/bookmark_specifics_conversions.h"
#include "components/sync_bookmarks/synced_bookmark_tracker_entity.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace sync_bookmarks {
namespace {
class UniquePositionWrapper { … };
}
BookmarkModelObserverImpl::BookmarkModelObserverImpl(
BookmarkModelView* bookmark_model,
const base::RepeatingClosure& nudge_for_commit_closure,
base::OnceClosure on_bookmark_model_being_deleted_closure,
SyncedBookmarkTracker* bookmark_tracker)
: … { … }
BookmarkModelObserverImpl::~BookmarkModelObserverImpl() = default;
void BookmarkModelObserverImpl::BookmarkModelLoaded(
bool ids_reassigned) { … }
void BookmarkModelObserverImpl::BookmarkModelBeingDeleted() { … }
void BookmarkModelObserverImpl::BookmarkNodeMoved(
const bookmarks::BookmarkNode* old_parent,
size_t old_index,
const bookmarks::BookmarkNode* new_parent,
size_t new_index) { … }
void BookmarkModelObserverImpl::BookmarkNodeAdded(
const bookmarks::BookmarkNode* parent,
size_t index,
bool added_by_user) { … }
void BookmarkModelObserverImpl::OnWillRemoveBookmarks(
const bookmarks::BookmarkNode* parent,
size_t old_index,
const bookmarks::BookmarkNode* node,
const base::Location& location) { … }
void BookmarkModelObserverImpl::BookmarkNodeRemoved(
const bookmarks::BookmarkNode* parent,
size_t old_index,
const bookmarks::BookmarkNode* node,
const std::set<GURL>& removed_urls,
const base::Location& location) { … }
void BookmarkModelObserverImpl::OnWillRemoveAllUserBookmarks(
const base::Location& location) { … }
void BookmarkModelObserverImpl::BookmarkAllUserNodesRemoved(
const std::set<GURL>& removed_urls,
const base::Location& location) { … }
void BookmarkModelObserverImpl::BookmarkNodeChanged(
const bookmarks::BookmarkNode* node) { … }
void BookmarkModelObserverImpl::BookmarkMetaInfoChanged(
const bookmarks::BookmarkNode* node) { … }
void BookmarkModelObserverImpl::BookmarkNodeFaviconChanged(
const bookmarks::BookmarkNode* node) { … }
void BookmarkModelObserverImpl::BookmarkNodeChildrenReordered(
const bookmarks::BookmarkNode* node) { … }
syncer::UniquePosition BookmarkModelObserverImpl::ComputePosition(
const bookmarks::BookmarkNode& parent,
size_t index) const { … }
void BookmarkModelObserverImpl::ProcessUpdate(
const SyncedBookmarkTrackerEntity* entity,
const sync_pb::EntitySpecifics& specifics) { … }
void BookmarkModelObserverImpl::ProcessDelete(
const bookmarks::BookmarkNode* node,
const base::Location& location) { … }
void BookmarkModelObserverImpl::
ProcessMovedDescendentsAsBookmarkNodeAddedRecursive(
const bookmarks::BookmarkNode* node) { … }
syncer::UniquePosition BookmarkModelObserverImpl::GetUniquePositionForNode(
const bookmarks::BookmarkNode* node) const { … }
syncer::UniquePosition BookmarkModelObserverImpl::UpdateUniquePositionForNode(
const bookmarks::BookmarkNode* node,
const syncer::UniquePosition& prev,
const syncer::UniquePosition& next) { … }
void BookmarkModelObserverImpl::UpdateAllUniquePositionsStartingAt(
const bookmarks::BookmarkNode* parent,
size_t start_index) { … }
}