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

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: Cleanup plus fixing build 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
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..6f1a57a7c60848905b40e3e2256a8ca6dd08a524 100644
--- a/components/bookmarks/browser/bookmark_model.h
+++ b/components/bookmarks/browser/bookmark_model.h
@@ -68,6 +68,20 @@ class BookmarkModel : public KeyedService {
base::string16 title;
};
+ class UndoDelegate {
sky 2015/10/07 16:30:15 Move into it's own header (see chromium specific s
jianli 2015/10/07 23:26:55 Done.
+ public:
+ // Called when a bookmark node was deleted. The delegate takes the ownership
+ // of the deleted node.
+ //
+ // |parent_node_id| the id of the parent of the node that will be removed.
+ // |index| the index of the node about to be removed in |parent|.
+ // |node| is the node to be deleted.
+ virtual void OnBookmarkNodeDeleted(BookmarkModel* model,
+ int64_t parent_node_id,
sky 2015/10/07 16:30:15 I would rather supply the BoomarkNode as the paren
jianli 2015/10/07 23:26:55 Done.
+ int index,
+ BookmarkNode* node) = 0;
sky 2015/10/07 16:30:15 Use scoped_ptr to clarify ownership.
jianli 2015/10/07 23:26:55 Done.
+ };
+
explicit BookmarkModel(BookmarkClient* client);
~BookmarkModel() override;
@@ -220,6 +234,12 @@ class BookmarkModel : public KeyedService {
const base::Time& creation_time,
const BookmarkNode::MetaInfoMap* meta_info);
+ // Adds the |node| at |parent| in the specified |index| and notifies its
+ // observers.
+ BookmarkNode* AddNode(BookmarkNode* parent,
sky 2015/10/07 16:30:15 I don't want this to be public. Expose an interfac
jianli 2015/10/07 23:26:56 Done.
+ int index,
+ BookmarkNode* node);
+
// Sorts the children of |parent|, notifying observers by way of the
// BookmarkNodeChildrenReordered method.
void SortChildren(const BookmarkNode* parent);
@@ -308,6 +328,10 @@ class BookmarkModel : public KeyedService {
// Returns the client used by this BookmarkModel.
BookmarkClient* client() const { return client_; }
+ void set_undo_delegate(UndoDelegate* undo_delegate) {
+ undo_delegate_ = undo_delegate;
+ }
+
private:
friend class BookmarkCodecTest;
friend class BookmarkModelFaviconTest;
@@ -354,12 +378,6 @@ class BookmarkModel : public KeyedService {
// Remove |node| from |nodes_ordered_by_url_set_| and |index_|.
void RemoveNodeFromInternalMaps(BookmarkNode* node);
- // Adds the |node| at |parent| in the specified |index| and notifies its
- // observers.
- BookmarkNode* AddNode(BookmarkNode* parent,
- int index,
- BookmarkNode* node);
-
// Adds the |node| to |nodes_ordered_by_url_set_| and |index_|.
void AddNodeToInternalMaps(BookmarkNode* node);
@@ -449,6 +467,8 @@ class BookmarkModel : public KeyedService {
std::set<std::string> non_cloned_keys_;
+ UndoDelegate* undo_delegate_;
+
DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
};
« no previous file with comments | « no previous file | components/bookmarks/browser/bookmark_model.cc » ('j') | components/bookmarks/browser/bookmark_model.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698