Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / undo / bookmark_undo_service.h
blobdc6c822d252c0c5f17f5de2771843a526f73b73b
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_
6 #define CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_
8 #include <map>
10 #include "chrome/browser/undo/bookmark_renumber_observer.h"
11 #include "chrome/browser/undo/undo_manager.h"
12 #include "components/bookmarks/browser/base_bookmark_model_observer.h"
13 #include "components/bookmarks/browser/bookmark_node_data.h"
14 #include "components/keyed_service/core/keyed_service.h"
16 class Profile;
17 namespace {
18 class BookmarkUndoOperation;
19 } // namespace
21 // BookmarkUndoService --------------------------------------------------------
23 // BookmarkUndoService is owned by the profile, and is responsible for observing
24 // BookmarkModel changes in order to provide an undo for those changes.
25 class BookmarkUndoService : public BaseBookmarkModelObserver,
26 public KeyedService,
27 public BookmarkRenumberObserver {
28 public:
29 explicit BookmarkUndoService(Profile* profile);
30 virtual ~BookmarkUndoService();
32 UndoManager* undo_manager() { return &undo_manager_; }
34 private:
35 // BaseBookmarkModelObserver:
36 virtual void BookmarkModelChanged() override {}
37 virtual void BookmarkModelLoaded(BookmarkModel* model,
38 bool ids_reassigned) override;
39 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override;
40 virtual void BookmarkNodeMoved(BookmarkModel* model,
41 const BookmarkNode* old_parent,
42 int old_index,
43 const BookmarkNode* new_parent,
44 int new_index) override;
45 virtual void BookmarkNodeAdded(BookmarkModel* model,
46 const BookmarkNode* parent,
47 int index) override;
48 virtual void OnWillRemoveBookmarks(BookmarkModel* model,
49 const BookmarkNode* parent,
50 int old_index,
51 const BookmarkNode* node) override;
52 virtual void OnWillRemoveAllUserBookmarks(BookmarkModel* model) override;
53 virtual void OnWillChangeBookmarkNode(BookmarkModel* model,
54 const BookmarkNode* node) override;
55 virtual void OnWillReorderBookmarkNode(BookmarkModel* model,
56 const BookmarkNode* node) override;
57 virtual void GroupedBookmarkChangesBeginning(BookmarkModel* model) override;
58 virtual void GroupedBookmarkChangesEnded(BookmarkModel* model) override;
60 // BookmarkRenumberObserver:
61 virtual void OnBookmarkRenumbered(int64 old_id, int64 new_id) override;
63 Profile* profile_;
64 UndoManager undo_manager_;
66 DISALLOW_COPY_AND_ASSIGN(BookmarkUndoService);
69 #endif // CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_