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

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

Issue 155913004: Eliminate Bookmarks dependence to bookmark_undo_utils.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: All grouped action to notify BookmarkModelObservers Created 6 years, 10 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
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 1302b3eb4702b904d48ab9e6e28d5cb0fdc97768..e5819b23edf9bcbd73a6050aa6a672e6b42f546a 100644
--- a/chrome/browser/undo/bookmark_undo_utils.cc
+++ b/chrome/browser/undo/bookmark_undo_utils.cc
@@ -1,50 +1,52 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#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() {
- UndoManager *undo_manager = GetUndoManager(profile_);
- if (undo_manager)
- undo_manager->ResumeUndoTracking();
-}
-
-// ScopedGroupBookmarkActions -------------------------------------------------
-
-ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(Profile* profile)
- : profile_(profile) {
- UndoManager *undo_manager = GetUndoManager(profile_);
- if (undo_manager)
- undo_manager->StartGroupingActions();
-}
-
-ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() {
- UndoManager *undo_manager = GetUndoManager(profile_);
- if (undo_manager)
- undo_manager->EndGroupingActions();
-}
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/undo/bookmark_undo_utils.h"
+
+#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.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() {
+ UndoManager *undo_manager = GetUndoManager(profile_);
+ if (undo_manager)
+ undo_manager->ResumeUndoTracking();
+}
+
+// ScopedGroupBookmarkActions -------------------------------------------------
+
+ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(Profile* profile)
+ : profile_(profile) {
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
+ if (model)
+ model->BeginGroupedChanges();
+}
+
+ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() {
+ BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
+ if (model)
+ model->EndGroupedChanges();
+}

Powered by Google App Engine
This is Rietveld 408576698