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

Unified Diff: components/bookmarks/browser/bookmark_model.h

Issue 1379983002: Supporting undoing bookmark deletion without creating new ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address some more feedback Created 5 years, 2 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
« no previous file with comments | « components/bookmarks/browser/BUILD.gn ('k') | components/bookmarks/browser/bookmark_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/browser/bookmark_model.h
diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h
index 27837703d0adc6719ef330fb483cd6afe1d1bcb7..7e17c1857479531a1f001c37e71698b950c1f432 100644
--- a/components/bookmarks/browser/bookmark_model.h
+++ b/components/bookmarks/browser/bookmark_model.h
@@ -20,6 +20,7 @@
#include "base/synchronization/waitable_event.h"
#include "components/bookmarks/browser/bookmark_client.h"
#include "components/bookmarks/browser/bookmark_node.h"
+#include "components/bookmarks/browser/bookmark_undo_provider.h"
#include "components/keyed_service/core/keyed_service.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@@ -47,6 +48,7 @@ class BookmarkIndex;
class BookmarkLoadDetails;
class BookmarkModelObserver;
class BookmarkStorage;
+class BookmarkUndoDelegate;
class ScopedGroupBookmarkActions;
class TestBookmarkClient;
struct BookmarkMatch;
@@ -61,7 +63,8 @@ struct BookmarkMatch;
//
// You should NOT directly create a BookmarkModel, instead go through the
// BookmarkModelFactory.
-class BookmarkModel : public KeyedService {
+class BookmarkModel : public BookmarkUndoProvider,
+ public KeyedService {
public:
struct URLAndTitle {
GURL url;
@@ -308,6 +311,8 @@ class BookmarkModel : public KeyedService {
// Returns the client used by this BookmarkModel.
BookmarkClient* client() const { return client_; }
+ void SetUndoDelegate(BookmarkUndoDelegate* undo_delegate);
+
private:
friend class BookmarkCodecTest;
friend class BookmarkModelFaviconTest;
@@ -323,6 +328,14 @@ class BookmarkModel : public KeyedService {
}
};
+ // BookmarkUndoProvider:
+ void RestoreRemovedNode(const BookmarkNode* parent,
+ int index,
+ scoped_ptr<BookmarkNode> node) override;
+
+ // Notifies the observers for adding every descedent of |node|.
+ void NotifyNodeAddedForAllDescendents(const BookmarkNode* node);
+
// Implementation of IsBookmarked. Before calling this the caller must obtain
// a lock on |url_lock_|.
bool IsBookmarkedNoLock(const GURL& url);
@@ -405,6 +418,8 @@ class BookmarkModel : public KeyedService {
scoped_ptr<BookmarkLoadDetails> CreateLoadDetails(
const std::string& accept_languages);
+ BookmarkUndoDelegate* undo_delegate() const;
+
BookmarkClient* const client_;
// Whether the initial set of data has been loaded.
@@ -449,6 +464,9 @@ class BookmarkModel : public KeyedService {
std::set<std::string> non_cloned_keys_;
+ BookmarkUndoDelegate* undo_delegate_;
+ scoped_ptr<BookmarkUndoDelegate> empty_undo_delegate_;
+
DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
};
« no previous file with comments | « components/bookmarks/browser/BUILD.gn ('k') | components/bookmarks/browser/bookmark_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698