OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |
6 #define CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ | 6 #define CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "chrome/browser/undo/bookmark_renumber_observer.h" | 10 #include "chrome/browser/undo/bookmark_renumber_observer.h" |
11 #include "chrome/browser/undo/undo_manager.h" | 11 #include "chrome/browser/undo/undo_manager.h" |
12 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 12 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
13 #include "components/bookmarks/browser/bookmark_node_data.h" | 13 #include "components/bookmarks/browser/bookmark_node_data.h" |
14 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 namespace { | 17 namespace { |
18 class BookmarkUndoOperation; | 18 class BookmarkUndoOperation; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 // BookmarkUndoService -------------------------------------------------------- | 21 // BookmarkUndoService -------------------------------------------------------- |
22 | 22 |
23 // BookmarkUndoService is owned by the profile, and is responsible for observing | 23 // BookmarkUndoService is owned by the profile, and is responsible for observing |
24 // BookmarkModel changes in order to provide an undo for those changes. | 24 // BookmarkModel changes in order to provide an undo for those changes. |
25 class BookmarkUndoService : public BaseBookmarkModelObserver, | 25 class BookmarkUndoService : public bookmarks::BaseBookmarkModelObserver, |
26 public KeyedService, | 26 public KeyedService, |
27 public BookmarkRenumberObserver { | 27 public BookmarkRenumberObserver { |
28 public: | 28 public: |
29 explicit BookmarkUndoService(Profile* profile); | 29 explicit BookmarkUndoService(Profile* profile); |
30 ~BookmarkUndoService() override; | 30 ~BookmarkUndoService() override; |
31 | 31 |
32 UndoManager* undo_manager() { return &undo_manager_; } | 32 UndoManager* undo_manager() { return &undo_manager_; } |
33 | 33 |
34 private: | 34 private: |
35 // BaseBookmarkModelObserver: | 35 // bookmarks::BaseBookmarkModelObserver: |
36 void BookmarkModelChanged() override {} | 36 void BookmarkModelChanged() override {} |
37 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; | 37 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; |
38 void BookmarkModelBeingDeleted(BookmarkModel* model) override; | 38 void BookmarkModelBeingDeleted(BookmarkModel* model) override; |
39 void BookmarkNodeMoved(BookmarkModel* model, | 39 void BookmarkNodeMoved(BookmarkModel* model, |
40 const BookmarkNode* old_parent, | 40 const BookmarkNode* old_parent, |
41 int old_index, | 41 int old_index, |
42 const BookmarkNode* new_parent, | 42 const BookmarkNode* new_parent, |
43 int new_index) override; | 43 int new_index) override; |
44 void BookmarkNodeAdded(BookmarkModel* model, | 44 void BookmarkNodeAdded(BookmarkModel* model, |
45 const BookmarkNode* parent, | 45 const BookmarkNode* parent, |
(...skipping 13 matching lines...) Expand all Loading... |
59 // BookmarkRenumberObserver: | 59 // BookmarkRenumberObserver: |
60 void OnBookmarkRenumbered(int64 old_id, int64 new_id) override; | 60 void OnBookmarkRenumbered(int64 old_id, int64 new_id) override; |
61 | 61 |
62 Profile* profile_; | 62 Profile* profile_; |
63 UndoManager undo_manager_; | 63 UndoManager undo_manager_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(BookmarkUndoService); | 65 DISALLOW_COPY_AND_ASSIGN(BookmarkUndoService); |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ | 68 #endif // CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |
OLD | NEW |