chromium/components/undo/bookmark_undo_service.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/undo/bookmark_undo_service.h"

#include <stddef.h>
#include <stdint.h>

#include <cstdint>
#include <memory>
#include <utility>

#include "base/check.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_node_data.h"
#include "components/bookmarks/browser/bookmark_undo_provider.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/browser/scoped_group_bookmark_actions.h"
#include "components/bookmarks/common/bookmark_metrics.h"
#include "components/strings/grit/components_strings.h"
#include "components/undo/undo_operation.h"

namespace {

BookmarkModel;
BookmarkNode;
BookmarkNodeData;
BookmarkUndoProvider;

// BookmarkUndoOperation ------------------------------------------------------

// Base class for all bookmark related UndoOperations that facilitates access to
// the BookmarkUndoService.
class BookmarkUndoOperation : public UndoOperation {};

// BookmarkAddOperation -------------------------------------------------------

// Handles the undo of the insertion of a bookmark or folder.
class BookmarkAddOperation : public BookmarkUndoOperation {};

BookmarkAddOperation::BookmarkAddOperation(BookmarkModel* bookmark_model,
                                           const BookmarkNode* parent,
                                           size_t index)
    :{}

void BookmarkAddOperation::Undo() {}

int BookmarkAddOperation::GetUndoLabelId() const {}

int BookmarkAddOperation::GetRedoLabelId() const {}

// BookmarkRemoveOperation ----------------------------------------------------

// Handles the undo of the deletion of a bookmark node. For a bookmark folder,
// the information for all descendant bookmark nodes is maintained.
//
// The BookmarkModel allows only single bookmark node to be removed.
class BookmarkRemoveOperation : public BookmarkUndoOperation {};

BookmarkRemoveOperation::BookmarkRemoveOperation(
    BookmarkModel* model,
    const BookmarkNode* parent,
    size_t index,
    std::unique_ptr<BookmarkNode> node)
    :{}

BookmarkRemoveOperation::~BookmarkRemoveOperation() = default;

void BookmarkRemoveOperation::Undo() {}

int BookmarkRemoveOperation::GetUndoLabelId() const {}

int BookmarkRemoveOperation::GetRedoLabelId() const {}

// BookmarkEditOperation ------------------------------------------------------

// Handles the undo of the modification of a bookmark node.
class BookmarkEditOperation : public BookmarkUndoOperation {};

BookmarkEditOperation::BookmarkEditOperation(
    BookmarkModel* bookmark_model,
    const BookmarkNode* node)
    :{}

void BookmarkEditOperation::Undo() {}

int BookmarkEditOperation::GetUndoLabelId() const {}

int BookmarkEditOperation::GetRedoLabelId() const {}

// BookmarkMoveOperation ------------------------------------------------------

// Handles the undo of a bookmark being moved to a new location.
class BookmarkMoveOperation : public BookmarkUndoOperation {};

BookmarkMoveOperation::BookmarkMoveOperation(BookmarkModel* bookmark_model,
                                             const BookmarkNode* old_parent,
                                             size_t old_index,
                                             const BookmarkNode* new_parent,
                                             size_t new_index)
    :{}

void BookmarkMoveOperation::Undo() {}

int BookmarkMoveOperation::GetUndoLabelId() const {}

int BookmarkMoveOperation::GetRedoLabelId() const {}

// BookmarkReorderOperation ---------------------------------------------------

// Handle the undo of reordering of bookmarks that can happen as a result of
// sorting a bookmark folder by name or the undo of that operation.  The change
// of order is not recursive so only the order of the immediate children of the
// folder need to be restored.
class BookmarkReorderOperation : public BookmarkUndoOperation {};

BookmarkReorderOperation::BookmarkReorderOperation(
    BookmarkModel* bookmark_model,
    const BookmarkNode* parent)
    :{}

BookmarkReorderOperation::~BookmarkReorderOperation() = default;

void BookmarkReorderOperation::Undo() {}

int BookmarkReorderOperation::GetUndoLabelId() const {}

int BookmarkReorderOperation::GetRedoLabelId() const {}

}  // namespace

// BookmarkUndoService --------------------------------------------------------

BookmarkUndoService::BookmarkUndoService() = default;
BookmarkUndoService::~BookmarkUndoService() = default;

void BookmarkUndoService::StartObservingBookmarkModel(BookmarkModel* model) {}

void BookmarkUndoService::Shutdown() {}

void BookmarkUndoService::BookmarkModelBeingDeleted() {}

void BookmarkUndoService::BookmarkNodeMoved(const BookmarkNode* old_parent,
                                            size_t old_index,
                                            const BookmarkNode* new_parent,
                                            size_t new_index) {}

void BookmarkUndoService::BookmarkNodeAdded(const BookmarkNode* parent,
                                            size_t index,
                                            bool added_by_user) {}

void BookmarkUndoService::OnWillChangeBookmarkNode(const BookmarkNode* node) {}

void BookmarkUndoService::OnWillReorderBookmarkNode(const BookmarkNode* node) {}

void BookmarkUndoService::GroupedBookmarkChangesBeginning() {}

void BookmarkUndoService::GroupedBookmarkChangesEnded() {}

void BookmarkUndoService::AddUndoEntryForRemovedNode(
    const BookmarkNode* parent,
    size_t index,
    std::unique_ptr<BookmarkNode> node) {}