| Index: chrome/browser/undo/bookmark_undo_utils.cc
|
| diff --git a/chrome/browser/undo/bookmark_undo_utils.cc b/chrome/browser/undo/bookmark_undo_utils.cc
|
| index cf78e5f08a7f1bd56f7b134d811e780db5cc8555..48dfeaca579270b28ba2a43f231f1396bfb268e8 100644
|
| --- a/chrome/browser/undo/bookmark_undo_utils.cc
|
| +++ b/chrome/browser/undo/bookmark_undo_utils.cc
|
| @@ -5,31 +5,20 @@
|
| #include "chrome/browser/undo/bookmark_undo_utils.h"
|
|
|
| #include "chrome/browser/undo/bookmark_undo_service.h"
|
| -#include "chrome/browser/undo/bookmark_undo_service_factory.h"
|
| #include "chrome/browser/undo/undo_manager.h"
|
|
|
| -namespace {
|
| -
|
| -// Utility funciton to safely return an UndoManager if available.
|
| -UndoManager* GetUndoManager(Profile* profile) {
|
| - BookmarkUndoService* undo_service = profile ?
|
| - BookmarkUndoServiceFactory::GetForProfile(profile) : NULL;
|
| - return undo_service ? undo_service->undo_manager() : NULL;
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| // ScopedSuspendBookmarkUndo --------------------------------------------------
|
|
|
| -ScopedSuspendBookmarkUndo::ScopedSuspendBookmarkUndo(Profile* profile)
|
| - : profile_(profile) {
|
| - UndoManager* undo_manager = GetUndoManager(profile_);
|
| - if (undo_manager)
|
| - undo_manager->SuspendUndoTracking();
|
| +ScopedSuspendBookmarkUndo::ScopedSuspendBookmarkUndo(
|
| + BookmarkUndoService* bookmark_undo_service)
|
| + : undo_manager_(bookmark_undo_service
|
| + ? bookmark_undo_service->undo_manager()
|
| + : nullptr) {
|
| + if (undo_manager_)
|
| + undo_manager_->SuspendUndoTracking();
|
| }
|
|
|
| ScopedSuspendBookmarkUndo::~ScopedSuspendBookmarkUndo() {
|
| - UndoManager *undo_manager = GetUndoManager(profile_);
|
| - if (undo_manager)
|
| - undo_manager->ResumeUndoTracking();
|
| + if (undo_manager_)
|
| + undo_manager_->ResumeUndoTracking();
|
| }
|
|
|