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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/undo/bookmark_undo_utils.h" 5 #include "chrome/browser/undo/bookmark_undo_utils.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
7 #include "chrome/browser/undo/bookmark_undo_service.h" 9 #include "chrome/browser/undo/bookmark_undo_service.h"
8 #include "chrome/browser/undo/bookmark_undo_service_factory.h" 10 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
9 #include "chrome/browser/undo/undo_manager.h" 11 #include "chrome/browser/undo/undo_manager.h"
10 12
11 namespace { 13 namespace {
12 14
13 // Utility funciton to safely return an UndoManager if available. 15 // Utility funciton to safely return an UndoManager if available.
14 UndoManager* GetUndoManager(Profile* profile) { 16 UndoManager* GetUndoManager(Profile* profile) {
15 BookmarkUndoService* undo_service = profile ? 17 BookmarkUndoService* undo_service = profile ?
16 BookmarkUndoServiceFactory::GetForProfile(profile) : NULL; 18 BookmarkUndoServiceFactory::GetForProfile(profile) : NULL;
(...skipping 14 matching lines...) Expand all
31 ScopedSuspendBookmarkUndo::~ScopedSuspendBookmarkUndo() { 33 ScopedSuspendBookmarkUndo::~ScopedSuspendBookmarkUndo() {
32 UndoManager *undo_manager = GetUndoManager(profile_); 34 UndoManager *undo_manager = GetUndoManager(profile_);
33 if (undo_manager) 35 if (undo_manager)
34 undo_manager->ResumeUndoTracking(); 36 undo_manager->ResumeUndoTracking();
35 } 37 }
36 38
37 // ScopedGroupBookmarkActions ------------------------------------------------- 39 // ScopedGroupBookmarkActions -------------------------------------------------
38 40
39 ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(Profile* profile) 41 ScopedGroupBookmarkActions::ScopedGroupBookmarkActions(Profile* profile)
40 : profile_(profile) { 42 : profile_(profile) {
41 UndoManager *undo_manager = GetUndoManager(profile_); 43 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
42 if (undo_manager) 44 if (model)
43 undo_manager->StartGroupingActions(); 45 model->BeginGroupedChanges();
44 } 46 }
45 47
46 ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() { 48 ScopedGroupBookmarkActions::~ScopedGroupBookmarkActions() {
47 UndoManager *undo_manager = GetUndoManager(profile_); 49 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
48 if (undo_manager) 50 if (model)
49 undo_manager->EndGroupingActions(); 51 model->EndGroupedChanges();
50 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698