bookmark_undo_utils.cc 824 B

123456789101112131415161718192021222324
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/undo/bookmark_undo_utils.h"
  5. #include "components/undo/bookmark_undo_service.h"
  6. #include "components/undo/undo_manager.h"
  7. // ScopedSuspendBookmarkUndo --------------------------------------------------
  8. ScopedSuspendBookmarkUndo::ScopedSuspendBookmarkUndo(
  9. BookmarkUndoService* bookmark_undo_service)
  10. : undo_manager_(bookmark_undo_service
  11. ? bookmark_undo_service->undo_manager()
  12. : nullptr) {
  13. if (undo_manager_)
  14. undo_manager_->SuspendUndoTracking();
  15. }
  16. ScopedSuspendBookmarkUndo::~ScopedSuspendBookmarkUndo() {
  17. if (undo_manager_)
  18. undo_manager_->ResumeUndoTracking();
  19. }