Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3417)

Unified Diff: chrome/browser/undo/bookmark_undo_utils.cc

Issue 1059523005: Remove dependency on //chrome from bookmark_undo_utils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tests
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/undo/bookmark_undo_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « chrome/browser/undo/bookmark_undo_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698