Chromium Code Reviews| Index: chrome/browser/undo/bookmark_undo_service.h |
| diff --git a/chrome/browser/undo/bookmark_undo_service.h b/chrome/browser/undo/bookmark_undo_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7ae94d7081c1c804d0aef23a48446e5c613d7f5 |
| --- /dev/null |
| +++ b/chrome/browser/undo/bookmark_undo_service.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2013 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. |
| + |
| +#ifndef CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |
| +#define CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |
| + |
| +#include <map> |
| + |
| +#include "chrome/browser/bookmarks/base_bookmark_model_observer.h" |
| +#include "chrome/browser/bookmarks/bookmark_node_data.h" |
| +#include "chrome/browser/undo/undo_manager.h" |
| +#include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
| + |
| +class Profile; |
| +namespace { |
| +class BookmarkUndoOperation; |
| +} // namespace |
| + |
| +// BookmarkUndoService -------------------------------------------------------- |
| + |
| +// BookmarkUndoService is owned by the profile, and is responsible for observing |
| +// changes to the BookmarkModel in order to provide an undo for those changes. |
| +class BookmarkUndoService : public BaseBookmarkModelObserver, |
| + public BrowserContextKeyedService { |
| + public: |
| + explicit BookmarkUndoService(Profile* profile); |
| + virtual ~BookmarkUndoService(); |
| + |
| + UndoManager* undo_manager() { return &undo_manager_; } |
| + |
| + // Should be called when a bookmark id has been renumbered so that any |
| + // BookmarkUndoOperations that refer to that bookmark can be updated. |
| + void OnBookmarkRenumbered(int64 old_id, int64 new_id); |
|
sky
2013/08/27 22:24:18
Can you make this private? Maybe move it into its
Tom Cassiotis
2013/09/04 13:44:43
I did this by defining BookmarkRenumberObserver.
|
| + |
| + private: |
| + // BaseBookmarkModelObserver: |
| + virtual void BookmarkModelChanged() OVERRIDE {} |
| + virtual void Loaded(BookmarkModel* model, bool ids_reassigned) OVERRIDE; |
| + virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; |
| + virtual void BookmarkNodeMoved(BookmarkModel* model, |
| + const BookmarkNode* old_parent, |
| + int old_index, |
| + const BookmarkNode* new_parent, |
| + int new_index) OVERRIDE; |
| + virtual void BookmarkNodeAdded(BookmarkModel* model, |
| + const BookmarkNode* parent, |
| + int index) OVERRIDE; |
| + virtual void OnWillRemoveBookmarks(BookmarkModel* model, |
| + const BookmarkNode* parent, |
| + int old_index, |
| + const BookmarkNode* node) OVERRIDE; |
| + virtual void OnWillRemoveAllBookmarks(BookmarkModel* model) OVERRIDE; |
| + virtual void OnWillChangeBookmarkNode(BookmarkModel* model, |
| + const BookmarkNode* node) OVERRIDE; |
| + virtual void OnWillReorderBookmarkNode(BookmarkModel* model, |
| + const BookmarkNode* node) OVERRIDE; |
| + |
| + Profile* profile_; |
| + UndoManager undo_manager_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BookmarkUndoService); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UNDO_BOOKMARK_UNDO_SERVICE_H_ |